1
0
mirror of https://github.com/oceanprotocol/market.git synced 2024-12-02 05:57:29 +01:00

Merge pull request #18 from oceanprotocol/feature/transactions

Feature/transactions
This commit is contained in:
mihaisc 2020-06-02 12:37:18 +03:00 committed by GitHub
commit c7efdb2001
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
67 changed files with 1714 additions and 758 deletions

View File

@ -7,20 +7,20 @@ SECRET_STORE_URI='http://localhost:12001'
FAUCET_URI='https://localhost:3001'
RATING_URI='http://localhost:8000'
#Nile dexFreight
#Nile market
#NODE_URI='https://nile.dev-ocean.com'
#AQUARIUS_URI='https://aquarius.nile.dexfreight.dev-ocean.com'
#BRIZO_URI='https://brizo.nile.dexfreight.dev-ocean.com'
#AQUARIUS_URI='https://aquarius.nile.market.dev-ocean.com'
#BRIZO_URI='https://brizo.nile.market.dev-ocean.com'
#BRIZO_ADDRESS='0xeD792C5FcC8bF3322a6ba89A6e51eF0B6fB3C530'
#SECRET_STORE_URI='https://secret-store.nile.dev-ocean.com'
#FAUCET_URI='https://faucet.nile.dev-ocean.com'
#RATING_URI='https://rating.nile.dexfreight.dev-ocean.com'
#RATING_URI='https://rating.nile.market.dev-ocean.com'
#Pacific dexFreight
#Pacific market
#NODE_URI='https://pacific.oceanprotocol.com'
#AQUARIUS_URI='https://aquarius.pacific.dexfreight.dev-ocean.com'
#BRIZO_URI='https://brizo.pacific.dexfreight.dev-ocean.com'
#AQUARIUS_URI='https://aquarius.pacific.market.dev-ocean.com'
#BRIZO_URI='https://brizo.pacific.market.dev-ocean.com'
#BRIZO_ADDRESS='0xeD792C5FcC8bF3322a6ba89A6e51eF0B6fB3C530'
#SECRET_STORE_URI='https://secret-store.oceanprotocol.com'
#FAUCET_URI='https://faucet.oceanprotocol.com'
#RATING_URI='https://rating.pacific.dexfreight.dev-ocean.com'
#RATING_URI='https://rating.pacific.market.dev-ocean.com'

View File

@ -24,7 +24,7 @@ before_script:
# - cd ..
- cp .env.example .env && cp .env.example .env.build
# overwrite AQUARIUS_URI from above .env files, which default to Spree
- export AQUARIUS_URI='https://aquarius.pacific.dexfreight.dev-ocean.com'
- export AQUARIUS_URI='https://aquarius.pacific.market.dev-ocean.com'
script:
# will run `npm ci` automatically here

625
package-lock.json generated
View File

@ -1,5 +1,5 @@
{
"name": "dexfreight",
"name": "market",
"version": "0.0.1",
"lockfileVersion": 1,
"requires": true,
@ -3397,431 +3397,14 @@
"integrity": "sha512-915dcnzCHEuvsmRKqVj0RxHT3T386lSJh8WREe4dsnrXHsi1ULNYxX0Ts/cvalv6bRL+aqyaZ6gN3l3nkfwEDg=="
},
"@oceanprotocol/react": {
"version": "0.0.3",
"resolved": "https://registry.npmjs.org/@oceanprotocol/react/-/react-0.0.3.tgz",
"integrity": "sha512-oC/IYQlQDlMDcmF85yvwxLaC3Am8bYoka1bivtfW/LM3bxtm0Z5y0VZtjuigBNmZf7mXXuATVNQjamN9W5VO3A==",
"version": "0.0.11",
"resolved": "https://registry.npmjs.org/@oceanprotocol/react/-/react-0.0.11.tgz",
"integrity": "sha512-uve2rxkqD83lNo77COSzw3/38JtUkxwfTtZHmMjLfOcvn0UD98RDS6oP1+BDzqH9K2AuDvIeTwu/YGAISskL/w==",
"requires": {
"@oceanprotocol/squid": "^2.1.1",
"@oceanprotocol/squid": "^2.2.0",
"axios": "^0.19.2",
"react": "^16.13.1",
"web3connect": "^1.0.0-beta.33"
},
"dependencies": {
"@ethereum-navigator/atlas": {
"version": "0.7.1",
"resolved": "https://registry.npmjs.org/@ethereum-navigator/atlas/-/atlas-0.7.1.tgz",
"integrity": "sha512-YV7tMVwpRcJbc+Kj/Rr0RzNV/2hHBEEM1/tMWDVLB15dGJfoQuRfPJpFt6uq+Ji6s3EkldIt9kZylEeG5ALKAA=="
},
"@ethereum-navigator/navigator": {
"version": "0.5.2",
"resolved": "https://registry.npmjs.org/@ethereum-navigator/navigator/-/navigator-0.5.2.tgz",
"integrity": "sha512-agSE2xzLxOKKid8QiS4v8jPhnFXW5uSXsICZ4JmS437aCZ8L3SUAy3cDQKikHb2PPZ3AazJO05k8m8i6u77peQ==",
"requires": {
"@ethereum-navigator/atlas": "^0.7.1",
"web3": "^1.2.7"
},
"dependencies": {
"web3": {
"version": "1.2.7",
"resolved": "https://registry.npmjs.org/web3/-/web3-1.2.7.tgz",
"integrity": "sha512-jAAJHMfUlTps+jH2li1ckDFEpPrEEriU/ubegSTGRl3KRdNhEqT93+3kd7FHJTn3NgjcyURo2+f7Da1YcZL8Mw==",
"requires": {
"web3-bzz": "1.2.7",
"web3-core": "1.2.7",
"web3-eth": "1.2.7",
"web3-eth-personal": "1.2.7",
"web3-net": "1.2.7",
"web3-shh": "1.2.7",
"web3-utils": "1.2.7"
}
}
}
},
"@oceanprotocol/squid": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/@oceanprotocol/squid/-/squid-2.1.1.tgz",
"integrity": "sha512-aoZttkArQ3qKsAHcaQfv6kFLpaSeGFHUSDRdK/MllJ5UFzclkDkBJd4P7XIJ5lS8uXOOBrrvQPxDU8wvf2yyMQ==",
"requires": {
"@ethereum-navigator/navigator": "^0.5.0",
"@oceanprotocol/keeper-contracts": "^0.13.2",
"@oceanprotocol/secret-store-client": "^0.0.15",
"bignumber.js": "^9.0.0",
"deprecated-decorator": "^0.1.6",
"node-fetch": "^2.6.0",
"save-file": "^2.3.1",
"uuid": "^7.0.2",
"web3": "^1.2.6",
"whatwg-url": "^8.0.0"
}
},
"@types/node": {
"version": "10.17.21",
"resolved": "https://registry.npmjs.org/@types/node/-/node-10.17.21.tgz",
"integrity": "sha512-PQKsydPxYxF1DsAFWmunaxd3sOi3iMt6Zmx/tgaagHYmwJ/9cRH91hQkeJZaUGWbvn0K5HlSVEXkn5U/llWPpQ=="
},
"get-stream": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz",
"integrity": "sha1-jpQ9E1jcN1VQVOy+LtsFqhdO3hQ="
},
"p-cancelable": {
"version": "0.3.0",
"resolved": "https://registry.npmjs.org/p-cancelable/-/p-cancelable-0.3.0.tgz",
"integrity": "sha512-RVbZPLso8+jFeq1MfNvgXtCRED2raz/dKpacfTNxsx6pLEpEomM7gah6VeHSYV3+vo0OAi4MkArtQcWWXuQoyw=="
},
"prepend-http": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/prepend-http/-/prepend-http-1.0.4.tgz",
"integrity": "sha1-1PRWKwzjaW5BrFLQ4ALlemNdxtw="
},
"swarm-js": {
"version": "0.1.40",
"resolved": "https://registry.npmjs.org/swarm-js/-/swarm-js-0.1.40.tgz",
"integrity": "sha512-yqiOCEoA4/IShXkY3WKwP5PvZhmoOOD8clsKA7EEcRILMkTEYHCQ21HDCAcVpmIxZq4LyZvWeRJ6quIyHk1caA==",
"requires": {
"bluebird": "^3.5.0",
"buffer": "^5.0.5",
"eth-lib": "^0.1.26",
"fs-extra": "^4.0.2",
"got": "^7.1.0",
"mime-types": "^2.1.16",
"mkdirp-promise": "^5.0.1",
"mock-fs": "^4.1.0",
"setimmediate": "^1.0.5",
"tar": "^4.0.2",
"xhr-request": "^1.0.1"
},
"dependencies": {
"got": {
"version": "7.1.0",
"resolved": "https://registry.npmjs.org/got/-/got-7.1.0.tgz",
"integrity": "sha512-Y5WMo7xKKq1muPsxD+KmrR8DH5auG7fBdDVueZwETwV6VytKyU9OX/ddpq2/1hp1vIPvVb4T81dKQz3BivkNLw==",
"requires": {
"decompress-response": "^3.2.0",
"duplexer3": "^0.1.4",
"get-stream": "^3.0.0",
"is-plain-obj": "^1.1.0",
"is-retry-allowed": "^1.0.0",
"is-stream": "^1.0.0",
"isurl": "^1.0.0-alpha5",
"lowercase-keys": "^1.0.0",
"p-cancelable": "^0.3.0",
"p-timeout": "^1.1.1",
"safe-buffer": "^5.0.1",
"timed-out": "^4.0.0",
"url-parse-lax": "^1.0.0",
"url-to-options": "^1.0.1"
}
}
}
},
"url-parse-lax": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/url-parse-lax/-/url-parse-lax-1.0.0.tgz",
"integrity": "sha1-evjzA2Rem9eaJy56FKxovAYJ2nM=",
"requires": {
"prepend-http": "^1.0.1"
}
},
"uuid": {
"version": "7.0.3",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-7.0.3.tgz",
"integrity": "sha512-DPSke0pXhTZgoF/d+WSt2QaKMCFSfx7QegxEWT+JOuHF5aWrKEn0G+ztjuJg/gG8/ItK+rbPCD/yNv8yyih6Cg=="
},
"web3-bzz": {
"version": "1.2.7",
"resolved": "https://registry.npmjs.org/web3-bzz/-/web3-bzz-1.2.7.tgz",
"integrity": "sha512-iTIWBR+Z+Bn09WprtKm46LmyNOasg2lUn++AjXkBTB8UNxlUybxtza84yl2ETTZUs0zuFzdSSAEgbjhygG+9oA==",
"requires": {
"@types/node": "^10.12.18",
"got": "9.6.0",
"swarm-js": "^0.1.40",
"underscore": "1.9.1"
}
},
"web3-core": {
"version": "1.2.7",
"resolved": "https://registry.npmjs.org/web3-core/-/web3-core-1.2.7.tgz",
"integrity": "sha512-QA0MTae0gXcr3KHe3cQ4x56+Wh43ZKWfMwg1gfCc3NNxPRM1jJ8qudzyptCAUcxUGXWpDG8syLIn1APDz5J8BQ==",
"requires": {
"@types/bn.js": "^4.11.4",
"@types/node": "^12.6.1",
"bignumber.js": "^9.0.0",
"web3-core-helpers": "1.2.7",
"web3-core-method": "1.2.7",
"web3-core-requestmanager": "1.2.7",
"web3-utils": "1.2.7"
},
"dependencies": {
"@types/node": {
"version": "12.12.38",
"resolved": "https://registry.npmjs.org/@types/node/-/node-12.12.38.tgz",
"integrity": "sha512-75eLjX0pFuTcUXnnWmALMzzkYorjND0ezNEycaKesbUBg9eGZp4GHPuDmkRc4mQQvIpe29zrzATNRA6hkYqwmA=="
}
}
},
"web3-core-helpers": {
"version": "1.2.7",
"resolved": "https://registry.npmjs.org/web3-core-helpers/-/web3-core-helpers-1.2.7.tgz",
"integrity": "sha512-bdU++9QATGeCetVrMp8pV97aQtVkN5oLBf/TWu/qumC6jK/YqrvLlBJLdwbz0QveU8zOSap6GCvJbqKvmmbV2A==",
"requires": {
"underscore": "1.9.1",
"web3-eth-iban": "1.2.7",
"web3-utils": "1.2.7"
}
},
"web3-core-method": {
"version": "1.2.7",
"resolved": "https://registry.npmjs.org/web3-core-method/-/web3-core-method-1.2.7.tgz",
"integrity": "sha512-e1TI0QUnByDMbQ8QHwnjxfjKw0LIgVRY4TYrlPijET9ebqUJU1HCayn/BHIMpV6LKyR1fQj9EldWyT64wZQXkg==",
"requires": {
"underscore": "1.9.1",
"web3-core-helpers": "1.2.7",
"web3-core-promievent": "1.2.7",
"web3-core-subscriptions": "1.2.7",
"web3-utils": "1.2.7"
}
},
"web3-core-promievent": {
"version": "1.2.7",
"resolved": "https://registry.npmjs.org/web3-core-promievent/-/web3-core-promievent-1.2.7.tgz",
"integrity": "sha512-jNmsM/czCeMGQqKKwM9/HZVTJVIF96hdMVNN/V9TGvp+EEE7vDhB4pUocDnc/QF9Z/5QFBCVmvNWttlRgZmU0A==",
"requires": {
"eventemitter3": "3.1.2"
}
},
"web3-core-requestmanager": {
"version": "1.2.7",
"resolved": "https://registry.npmjs.org/web3-core-requestmanager/-/web3-core-requestmanager-1.2.7.tgz",
"integrity": "sha512-HJb/txjHixu1dxIebiZQKBoJCaNu4gsh7mq/uj6Z/w6tIHbybL90s/7ADyMED353yyJ2tDWtYJqeMVAR+KtdaA==",
"requires": {
"underscore": "1.9.1",
"web3-core-helpers": "1.2.7",
"web3-providers-http": "1.2.7",
"web3-providers-ipc": "1.2.7",
"web3-providers-ws": "1.2.7"
}
},
"web3-core-subscriptions": {
"version": "1.2.7",
"resolved": "https://registry.npmjs.org/web3-core-subscriptions/-/web3-core-subscriptions-1.2.7.tgz",
"integrity": "sha512-W/CzQYOUawdMDvkgA/fmLsnG5aMpbjrs78LZMbc0MFXLpH3ofqAgO2by4QZrrTShUUTeWS0ZuEkFFL/iFrSObw==",
"requires": {
"eventemitter3": "3.1.2",
"underscore": "1.9.1",
"web3-core-helpers": "1.2.7"
}
},
"web3-eth": {
"version": "1.2.7",
"resolved": "https://registry.npmjs.org/web3-eth/-/web3-eth-1.2.7.tgz",
"integrity": "sha512-ljLd0oB4IjWkzFGVan4HkYhJXhSXgn9iaSaxdJixKGntZPgWMJfxeA+uLwTrlxrWzhvy4f+39WnT7wCh5e9TGg==",
"requires": {
"underscore": "1.9.1",
"web3-core": "1.2.7",
"web3-core-helpers": "1.2.7",
"web3-core-method": "1.2.7",
"web3-core-subscriptions": "1.2.7",
"web3-eth-abi": "1.2.7",
"web3-eth-accounts": "1.2.7",
"web3-eth-contract": "1.2.7",
"web3-eth-ens": "1.2.7",
"web3-eth-iban": "1.2.7",
"web3-eth-personal": "1.2.7",
"web3-net": "1.2.7",
"web3-utils": "1.2.7"
}
},
"web3-eth-abi": {
"version": "1.2.7",
"resolved": "https://registry.npmjs.org/web3-eth-abi/-/web3-eth-abi-1.2.7.tgz",
"integrity": "sha512-4FnlT1q+D0XBkxSMXlIb/eG337uQeMaUdtVQ4PZ3XzxqpcoDuMgXm4o+3NRxnWmr4AMm6QKjM+hcC7c0mBKcyg==",
"requires": {
"ethers": "4.0.0-beta.3",
"underscore": "1.9.1",
"web3-utils": "1.2.7"
}
},
"web3-eth-accounts": {
"version": "1.2.7",
"resolved": "https://registry.npmjs.org/web3-eth-accounts/-/web3-eth-accounts-1.2.7.tgz",
"integrity": "sha512-AE7QWi/iIQIjXwlAPtlMabm/OPFF0a1PhxT1EiTckpYNP8fYs6jW7lYxEtJPPJIKqfMjoi1xkEqTVR1YZQ88lg==",
"requires": {
"@web3-js/scrypt-shim": "^0.1.0",
"crypto-browserify": "3.12.0",
"eth-lib": "^0.2.8",
"ethereumjs-common": "^1.3.2",
"ethereumjs-tx": "^2.1.1",
"underscore": "1.9.1",
"uuid": "3.3.2",
"web3-core": "1.2.7",
"web3-core-helpers": "1.2.7",
"web3-core-method": "1.2.7",
"web3-utils": "1.2.7"
},
"dependencies": {
"eth-lib": {
"version": "0.2.8",
"resolved": "https://registry.npmjs.org/eth-lib/-/eth-lib-0.2.8.tgz",
"integrity": "sha512-ArJ7x1WcWOlSpzdoTBX8vkwlkSQ85CjjifSZtV4co64vWxSV8geWfPI9x4SVYu3DSxnX4yWFVTtGL+j9DUFLNw==",
"requires": {
"bn.js": "^4.11.6",
"elliptic": "^6.4.0",
"xhr-request-promise": "^0.1.2"
}
},
"uuid": {
"version": "3.3.2",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.2.tgz",
"integrity": "sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA=="
}
}
},
"web3-eth-contract": {
"version": "1.2.7",
"resolved": "https://registry.npmjs.org/web3-eth-contract/-/web3-eth-contract-1.2.7.tgz",
"integrity": "sha512-uW23Y0iL7XroRNbf9fWZ1N6OYhEYTJX8gTuYASuRnpYrISN5QGiQML6pq/NCzqypR1bl5E0fuINZQSK/xefIVw==",
"requires": {
"@types/bn.js": "^4.11.4",
"underscore": "1.9.1",
"web3-core": "1.2.7",
"web3-core-helpers": "1.2.7",
"web3-core-method": "1.2.7",
"web3-core-promievent": "1.2.7",
"web3-core-subscriptions": "1.2.7",
"web3-eth-abi": "1.2.7",
"web3-utils": "1.2.7"
}
},
"web3-eth-ens": {
"version": "1.2.7",
"resolved": "https://registry.npmjs.org/web3-eth-ens/-/web3-eth-ens-1.2.7.tgz",
"integrity": "sha512-SPRnvUNWQ0CnnTDBteGIJkvFWEizJcAHlVsrFLICwcwFZu+appjX1UOaoGu2h3GXWtc/XZlu7B451Gi+Os2cTg==",
"requires": {
"eth-ens-namehash": "2.0.8",
"underscore": "1.9.1",
"web3-core": "1.2.7",
"web3-core-helpers": "1.2.7",
"web3-core-promievent": "1.2.7",
"web3-eth-abi": "1.2.7",
"web3-eth-contract": "1.2.7",
"web3-utils": "1.2.7"
}
},
"web3-eth-iban": {
"version": "1.2.7",
"resolved": "https://registry.npmjs.org/web3-eth-iban/-/web3-eth-iban-1.2.7.tgz",
"integrity": "sha512-2NrClz1PoQ3nSJBd+91ylCOVga9qbTxjRofq/oSCoHVAEvz3WZyttx9k5DC+0rWqwJF1h69ufFvdHAAlmN/4lg==",
"requires": {
"bn.js": "4.11.8",
"web3-utils": "1.2.7"
}
},
"web3-eth-personal": {
"version": "1.2.7",
"resolved": "https://registry.npmjs.org/web3-eth-personal/-/web3-eth-personal-1.2.7.tgz",
"integrity": "sha512-2OAa1Spz0uB29dwCM8+1y0So7E47A4gKznjBEwXIYEcUIsvwT5X7ofFhC2XxyRpqlIWZSQAxRSSJFyupRRXzyw==",
"requires": {
"@types/node": "^12.6.1",
"web3-core": "1.2.7",
"web3-core-helpers": "1.2.7",
"web3-core-method": "1.2.7",
"web3-net": "1.2.7",
"web3-utils": "1.2.7"
},
"dependencies": {
"@types/node": {
"version": "12.12.38",
"resolved": "https://registry.npmjs.org/@types/node/-/node-12.12.38.tgz",
"integrity": "sha512-75eLjX0pFuTcUXnnWmALMzzkYorjND0ezNEycaKesbUBg9eGZp4GHPuDmkRc4mQQvIpe29zrzATNRA6hkYqwmA=="
}
}
},
"web3-net": {
"version": "1.2.7",
"resolved": "https://registry.npmjs.org/web3-net/-/web3-net-1.2.7.tgz",
"integrity": "sha512-j9qeZrS1FNyCeA0BfdLojkxOZQz3FKa1DJI+Dw9fEVhZS68vLOFANu2RB96gR9BoPHo5+k5D3NsKOoxt1gw3Gg==",
"requires": {
"web3-core": "1.2.7",
"web3-core-method": "1.2.7",
"web3-utils": "1.2.7"
}
},
"web3-providers-http": {
"version": "1.2.7",
"resolved": "https://registry.npmjs.org/web3-providers-http/-/web3-providers-http-1.2.7.tgz",
"integrity": "sha512-vazGx5onuH/zogrwkUaLFJwFcJ6CckP65VFSHoiV+GTQdkOqgoDIha7StKkslvDz4XJ2FuY/zOZHbtuOYeltXQ==",
"requires": {
"web3-core-helpers": "1.2.7",
"xhr2-cookies": "1.1.0"
}
},
"web3-providers-ipc": {
"version": "1.2.7",
"resolved": "https://registry.npmjs.org/web3-providers-ipc/-/web3-providers-ipc-1.2.7.tgz",
"integrity": "sha512-/zc0y724H2zbkV4UbGGMhsEiLfafjagIzfrsWZnyTZUlSB0OGRmmFm2EkLJAgtXrLiodaHHyXKM0vB8S24bxdA==",
"requires": {
"oboe": "2.1.4",
"underscore": "1.9.1",
"web3-core-helpers": "1.2.7"
}
},
"web3-providers-ws": {
"version": "1.2.7",
"resolved": "https://registry.npmjs.org/web3-providers-ws/-/web3-providers-ws-1.2.7.tgz",
"integrity": "sha512-b5XzqDpRkNVe6MFs5K6iqOEyjQikHtg3KuU2/ClCDV37hm0WN4xCRVMC0LwegulbDXZej3zT9+1CYzGaGFREzA==",
"requires": {
"@web3-js/websocket": "^1.0.29",
"eventemitter3": "^4.0.0",
"underscore": "1.9.1",
"web3-core-helpers": "1.2.7"
},
"dependencies": {
"eventemitter3": {
"version": "4.0.3",
"resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.3.tgz",
"integrity": "sha512-HyaFeyfTa18nYjft59vEPsvuq6ZVcrCC1rBw6Fx8ZV9NcuUITBNCnTOyr0tHHkkHn//d+lzhsL1YybgtLQ7lng=="
}
}
},
"web3-shh": {
"version": "1.2.7",
"resolved": "https://registry.npmjs.org/web3-shh/-/web3-shh-1.2.7.tgz",
"integrity": "sha512-f6PAgcpG0ZAo98KqCmeHoDEx5qzm3d5plet18DkT4U6WIeYowKdec8vZaLPRR7c2XreXFJ2gQf45CB7oqR7U/w==",
"requires": {
"web3-core": "1.2.7",
"web3-core-method": "1.2.7",
"web3-core-subscriptions": "1.2.7",
"web3-net": "1.2.7"
}
},
"web3-utils": {
"version": "1.2.7",
"resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-1.2.7.tgz",
"integrity": "sha512-FBh/CPJND+eiPeUF9KVbTyTZtXNWxPWtByBaWS6e2x4ACazPX711EeNaZaChIOGSLGe6se2n7kg6wnawe/MjuQ==",
"requires": {
"bn.js": "4.11.8",
"eth-lib": "0.2.7",
"ethereum-bloom-filters": "^1.0.6",
"ethjs-unit": "0.1.6",
"number-to-bn": "1.7.0",
"randombytes": "^2.1.0",
"underscore": "1.9.1",
"utf8": "3.0.0"
},
"dependencies": {
"eth-lib": {
"version": "0.2.7",
"resolved": "https://registry.npmjs.org/eth-lib/-/eth-lib-0.2.7.tgz",
"integrity": "sha1-L5Pxex4jrsN1nNSj/iDBKGo/wco=",
"requires": {
"bn.js": "^4.11.6",
"elliptic": "^6.4.0",
"xhr-request-promise": "^0.1.2"
}
}
}
}
}
},
"@oceanprotocol/secret-store-client": {
@ -3833,9 +3416,9 @@
}
},
"@oceanprotocol/squid": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/@oceanprotocol/squid/-/squid-2.1.1.tgz",
"integrity": "sha512-aoZttkArQ3qKsAHcaQfv6kFLpaSeGFHUSDRdK/MllJ5UFzclkDkBJd4P7XIJ5lS8uXOOBrrvQPxDU8wvf2yyMQ==",
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/@oceanprotocol/squid/-/squid-2.2.0.tgz",
"integrity": "sha512-ISI+8mGl5lCPqLw/YPS/e0PhaqgexuGiwxKcCGAMSo1p8sgunr6FOrMVoYhYr52QpfodxOY8Iiy3zv4HC8O2Mg==",
"requires": {
"@ethereum-navigator/navigator": "^0.5.0",
"@oceanprotocol/keeper-contracts": "^0.13.2",
@ -3844,15 +3427,15 @@
"deprecated-decorator": "^0.1.6",
"node-fetch": "^2.6.0",
"save-file": "^2.3.1",
"uuid": "^7.0.2",
"uuid": "^8.0.0",
"web3": "^1.2.6",
"whatwg-url": "^8.0.0"
},
"dependencies": {
"uuid": {
"version": "7.0.3",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-7.0.3.tgz",
"integrity": "sha512-DPSke0pXhTZgoF/d+WSt2QaKMCFSfx7QegxEWT+JOuHF5aWrKEn0G+ztjuJg/gG8/ItK+rbPCD/yNv8yyih6Cg=="
"version": "8.0.0",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-8.0.0.tgz",
"integrity": "sha512-jOXGuXZAWdsTH7eZLtyXMqUb9EcWMGZNbL9YcGBJl4MH4nrxHmZJhEHvyLFrkxo+28uLb/NYRcStH48fnD0Vzw=="
}
}
},
@ -3861,6 +3444,11 @@
"resolved": "https://registry.npmjs.org/@oceanprotocol/typographies/-/typographies-0.1.0.tgz",
"integrity": "sha512-kMsZsqvzpz9KzVbVZzllwhPoIC3zbqsdRrClagZL/C2PHzgLrKGC1kYn3gPt0RMIFg9ZjrwieKaxlgIK9i9zzg=="
},
"@popperjs/core": {
"version": "2.4.0",
"resolved": "https://registry.npmjs.org/@popperjs/core/-/core-2.4.0.tgz",
"integrity": "sha512-NMrDy6EWh9TPdSRiHmHH2ye1v5U0gBD7pRYwSwJvomx7Bm4GG04vu63dYiVzebLOx2obPpJugew06xVP0Nk7hA=="
},
"@reach/router": {
"version": "1.3.3",
"resolved": "https://registry.npmjs.org/@reach/router/-/router-1.3.3.tgz",
@ -3878,6 +3466,38 @@
"resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-0.14.0.tgz",
"integrity": "sha512-9NET910DNaIPngYnLLPeg+Ogzqsi9uM4mSboU5y6p8S5DzMTVEsJZrawi+BoDNUVBa2DhJqQYUFvMDfgU062LQ=="
},
"@sindresorhus/slugify": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/@sindresorhus/slugify/-/slugify-1.0.0.tgz",
"integrity": "sha512-g3L0EoNpi2rT/uiOO6BUqbqXZ9mPR+LCl6yZsTDd8K/PeX+Bui5npU+mY0sME+Mc96bW/32kfDhmccPLMK/7pQ==",
"requires": {
"@sindresorhus/transliterate": "^0.1.0",
"escape-string-regexp": "^4.0.0"
},
"dependencies": {
"escape-string-regexp": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz",
"integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA=="
}
}
},
"@sindresorhus/transliterate": {
"version": "0.1.0",
"resolved": "https://registry.npmjs.org/@sindresorhus/transliterate/-/transliterate-0.1.0.tgz",
"integrity": "sha512-bO6v0M0EuJPjm5Ntfow4nk+r3EZQ41n0ahvAmh766FzPqlm6V/2uDc01vZI3gLeI/1lgV2BTMb6QvxOk9z73ng==",
"requires": {
"escape-string-regexp": "^2.0.0",
"lodash.deburr": "^4.1.0"
},
"dependencies": {
"escape-string-regexp": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz",
"integrity": "sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w=="
}
}
},
"@sinonjs/commons": {
"version": "1.7.1",
"resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-1.7.1.tgz",
@ -5080,6 +4700,15 @@
"@types/testing-library__react-hooks": "^3.0.0"
}
},
"@tippyjs/react": {
"version": "4.0.2",
"resolved": "https://registry.npmjs.org/@tippyjs/react/-/react-4.0.2.tgz",
"integrity": "sha512-iAKTjUmrXqTTJ4HZRDgmvVfUiv9pTzJoDjPLDbmvB6vttkuYvZ/o8NhHa72vMFgHpiMFNoYWtB8OCRR6x5Zs8w==",
"requires": {
"prop-types": "^15.6.2",
"tippy.js": "^6.2.0"
}
},
"@toruslabs/fetch-node-details": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/@toruslabs/fetch-node-details/-/fetch-node-details-2.0.2.tgz",
@ -5145,7 +4774,7 @@
"resolved": "https://registry.npmjs.org/web3/-/web3-0.20.7.tgz",
"integrity": "sha512-VU6/DSUX93d1fCzBz7WP/SGCQizO1rKZi4Px9j/3yRyfssHyFcZamMw2/sj4E8TlfMXONvZLoforR8B4bRoyTQ==",
"requires": {
"bignumber.js": "git+https://github.com/frozeman/bignumber.js-nolookahead.git#57692b3ecfc98bbdd6b3a516cb2353652ea49934",
"bignumber.js": "git+https://github.com/frozeman/bignumber.js-nolookahead.git",
"crypto-js": "^3.1.4",
"utf8": "^2.1.1",
"xhr2-cookies": "^1.1.0",
@ -5223,6 +4852,11 @@
"@types/node": "*"
}
},
"@types/classnames": {
"version": "2.2.10",
"resolved": "https://registry.npmjs.org/@types/classnames/-/classnames-2.2.10.tgz",
"integrity": "sha512-1UzDldn9GfYYEsWWnn/P4wkTlkZDH7lDb0wBMGbtIQc9zXEQq7FlKBdZUn6OBqD8sKZZ2RQO2mAjGpXiDGoRmQ=="
},
"@types/color-name": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/@types/color-name/-/color-name-1.1.1.tgz",
@ -8714,7 +8348,8 @@
},
"ansi-regex": {
"version": "2.1.1",
"bundled": true
"bundled": true,
"optional": true
},
"aproba": {
"version": "1.2.0",
@ -8732,11 +8367,13 @@
},
"balanced-match": {
"version": "1.0.0",
"bundled": true
"bundled": true,
"optional": true
},
"brace-expansion": {
"version": "1.1.11",
"bundled": true,
"optional": true,
"requires": {
"balanced-match": "^1.0.0",
"concat-map": "0.0.1"
@ -8749,15 +8386,18 @@
},
"code-point-at": {
"version": "1.1.0",
"bundled": true
"bundled": true,
"optional": true
},
"concat-map": {
"version": "0.0.1",
"bundled": true
"bundled": true,
"optional": true
},
"console-control-strings": {
"version": "1.1.0",
"bundled": true
"bundled": true,
"optional": true
},
"core-util-is": {
"version": "1.0.2",
@ -8860,7 +8500,8 @@
},
"inherits": {
"version": "2.0.4",
"bundled": true
"bundled": true,
"optional": true
},
"ini": {
"version": "1.3.5",
@ -8870,6 +8511,7 @@
"is-fullwidth-code-point": {
"version": "1.0.0",
"bundled": true,
"optional": true,
"requires": {
"number-is-nan": "^1.0.0"
}
@ -8882,17 +8524,20 @@
"minimatch": {
"version": "3.0.4",
"bundled": true,
"optional": true,
"requires": {
"brace-expansion": "^1.1.7"
}
},
"minimist": {
"version": "0.0.8",
"bundled": true
"bundled": true,
"optional": true
},
"minipass": {
"version": "2.9.0",
"bundled": true,
"optional": true,
"requires": {
"safe-buffer": "^5.1.2",
"yallist": "^3.0.0"
@ -8909,6 +8554,7 @@
"mkdirp": {
"version": "0.5.1",
"bundled": true,
"optional": true,
"requires": {
"minimist": "0.0.8"
}
@ -8989,7 +8635,8 @@
},
"number-is-nan": {
"version": "1.0.1",
"bundled": true
"bundled": true,
"optional": true
},
"object-assign": {
"version": "4.1.1",
@ -8999,6 +8646,7 @@
"once": {
"version": "1.4.0",
"bundled": true,
"optional": true,
"requires": {
"wrappy": "1"
}
@ -9074,7 +8722,8 @@
},
"safe-buffer": {
"version": "5.1.2",
"bundled": true
"bundled": true,
"optional": true
},
"safer-buffer": {
"version": "2.1.2",
@ -9104,6 +8753,7 @@
"string-width": {
"version": "1.0.2",
"bundled": true,
"optional": true,
"requires": {
"code-point-at": "^1.0.0",
"is-fullwidth-code-point": "^1.0.0",
@ -9121,6 +8771,7 @@
"strip-ansi": {
"version": "3.0.1",
"bundled": true,
"optional": true,
"requires": {
"ansi-regex": "^2.0.0"
}
@ -9159,11 +8810,13 @@
},
"wrappy": {
"version": "1.0.2",
"bundled": true
"bundled": true,
"optional": true
},
"yallist": {
"version": "3.1.1",
"bundled": true
"bundled": true,
"optional": true
}
}
},
@ -10412,6 +10065,11 @@
"integrity": "sha512-b+QLs5vHgS+IoSNcUE4n9HP2NwcHj7aqnJWsjPtuG75Rh5TOaGt0OjAYInh77d5T16V5cRDC+Pw/6ZZZiETBGw==",
"dev": true
},
"deepmerge": {
"version": "4.2.2",
"resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.2.2.tgz",
"integrity": "sha512-FJ3UgI4gIl+PHZm53knsuSFpE+nESMr7M4v9QcgB7S63Kj/6WqMiFQJpBBYz1Pt+66bZpP3Q7Lye0Oo9MPKEdg=="
},
"defaults": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/defaults/-/defaults-1.0.3.tgz",
@ -11772,7 +11430,7 @@
"resolved": "https://registry.npmjs.org/eth-sig-util/-/eth-sig-util-1.4.2.tgz",
"integrity": "sha1-jZWCAsftuq6Dlwf7pvCf8ydgYhA=",
"requires": {
"ethereumjs-abi": "git+https://github.com/ethereumjs/ethereumjs-abi.git#1cfbb13862f90f0b391d8a699544d5fe4dfb8c7b",
"ethereumjs-abi": "git+https://github.com/ethereumjs/ethereumjs-abi.git",
"ethereumjs-util": "^5.1.1"
},
"dependencies": {
@ -15941,7 +15599,8 @@
"ansi-regex": {
"version": "2.1.1",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"aproba": {
"version": "1.2.0",
@ -15962,12 +15621,14 @@
"balanced-match": {
"version": "1.0.0",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"brace-expansion": {
"version": "1.1.11",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"balanced-match": "^1.0.0",
"concat-map": "0.0.1"
@ -15982,17 +15643,20 @@
"code-point-at": {
"version": "1.1.0",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"concat-map": {
"version": "0.0.1",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"console-control-strings": {
"version": "1.1.0",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"core-util-is": {
"version": "1.0.2",
@ -16109,7 +15773,8 @@
"inherits": {
"version": "2.0.4",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"ini": {
"version": "1.3.5",
@ -16121,6 +15786,7 @@
"version": "1.0.0",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"number-is-nan": "^1.0.0"
}
@ -16135,6 +15801,7 @@
"version": "3.0.4",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"brace-expansion": "^1.1.7"
}
@ -16142,12 +15809,14 @@
"minimist": {
"version": "0.0.8",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"minipass": {
"version": "2.9.0",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"safe-buffer": "^5.1.2",
"yallist": "^3.0.0"
@ -16166,6 +15835,7 @@
"version": "0.5.1",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"minimist": "0.0.8"
}
@ -16255,7 +15925,8 @@
"number-is-nan": {
"version": "1.0.1",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"object-assign": {
"version": "4.1.1",
@ -16267,6 +15938,7 @@
"version": "1.4.0",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"wrappy": "1"
}
@ -16352,7 +16024,8 @@
"safe-buffer": {
"version": "5.1.2",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"safer-buffer": {
"version": "2.1.2",
@ -16388,6 +16061,7 @@
"version": "1.0.2",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"code-point-at": "^1.0.0",
"is-fullwidth-code-point": "^1.0.0",
@ -16407,6 +16081,7 @@
"version": "3.0.1",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"ansi-regex": "^2.0.0"
}
@ -16450,12 +16125,14 @@
"wrappy": {
"version": "1.0.2",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"yallist": {
"version": "3.1.1",
"bundled": true,
"dev": true
"dev": true,
"optional": true
}
}
},
@ -19393,6 +19070,11 @@
"resolved": "https://registry.npmjs.org/lodash.debounce/-/lodash.debounce-4.0.8.tgz",
"integrity": "sha1-gteb/zCmfEAF/9XiUVMArZyk168="
},
"lodash.deburr": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/lodash.deburr/-/lodash.deburr-4.1.0.tgz",
"integrity": "sha1-3bG7s+8HRYwBd7oH3hRCLLAz/5s="
},
"lodash.defaults": {
"version": "4.2.0",
"resolved": "https://registry.npmjs.org/lodash.defaults/-/lodash.defaults-4.2.0.tgz",
@ -19444,6 +19126,11 @@
"resolved": "https://registry.npmjs.org/lodash.once/-/lodash.once-4.1.1.tgz",
"integrity": "sha1-DdOXEhPHxW34gJd9UEyI+0cal6w="
},
"lodash.orderby": {
"version": "4.6.0",
"resolved": "https://registry.npmjs.org/lodash.orderby/-/lodash.orderby-4.6.0.tgz",
"integrity": "sha1-5pfwTOXXhSL1TZM4syuBozk+TrM="
},
"lodash.sortby": {
"version": "4.7.0",
"resolved": "https://registry.npmjs.org/lodash.sortby/-/lodash.sortby-4.7.0.tgz",
@ -20952,6 +20639,11 @@
"tslib": "^1.10.0"
}
},
"no-scroll": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/no-scroll/-/no-scroll-2.1.1.tgz",
"integrity": "sha512-YTzGAJOo/B6hkodeT5SKKHpOhAzjMfkUCCXjLJwjWk2F4/InIg+HbdH9kmT7bKpleDuqLZDTRy2OdNtAj0IVyQ=="
},
"node-dir": {
"version": "0.1.17",
"resolved": "https://registry.npmjs.org/node-dir/-/node-dir-0.1.17.tgz",
@ -22621,6 +22313,16 @@
"@babel/runtime": "^7.0.0"
}
},
"react-data-table-component": {
"version": "6.9.2",
"resolved": "https://registry.npmjs.org/react-data-table-component/-/react-data-table-component-6.9.2.tgz",
"integrity": "sha512-U7wHNes+NnWyoc9UoHBYgnOuW1OiFPLW9Bm4AwtDny+6czJVs6u5zE53yIj3LgqtX0wE11E83UoLxUd44B/T/g==",
"requires": {
"deepmerge": "^4.2.2",
"lodash.orderby": "^4.6.0",
"shortid": "^2.2.15"
}
},
"react-datepicker": {
"version": "2.14.0",
"resolved": "https://registry.npmjs.org/react-datepicker/-/react-datepicker-2.14.0.tgz",
@ -23077,6 +22779,15 @@
"@types/react": "^16.0.40"
}
},
"react-responsive-modal": {
"version": "5.0.2",
"resolved": "https://registry.npmjs.org/react-responsive-modal/-/react-responsive-modal-5.0.2.tgz",
"integrity": "sha512-7QzL5NIhzYKe+jnl3QQVBWlpVCQv6QDCKtlJQvBxEbnjNSMkwFep2uSTu4CQFt9QItFEBV7onC/1i6O0t78nYg==",
"requires": {
"classnames": "^2.2.6",
"no-scroll": "^2.1.1"
}
},
"react-sizeme": {
"version": "2.6.12",
"resolved": "https://registry.npmjs.org/react-sizeme/-/react-sizeme-2.6.12.tgz",
@ -25690,6 +25401,14 @@
"dev": true,
"optional": true
},
"tippy.js": {
"version": "6.2.3",
"resolved": "https://registry.npmjs.org/tippy.js/-/tippy.js-6.2.3.tgz",
"integrity": "sha512-MzqHMrr2C0IC8ZUnG5kLQPxonWJ7V+Usqiy2W5b+dCvAfousio0mA85h+Ea5wRq94AQGd8mbFGeciRgkP+F+7w==",
"requires": {
"@popperjs/core": "^2.3.2"
}
},
"tlds": {
"version": "1.207.0",
"resolved": "https://registry.npmjs.org/tlds/-/tlds-1.207.0.tgz",

View File

@ -1,6 +1,6 @@
{
"name": "dexfreight",
"description": "Data marketplace for dexFreight.",
"name": "market",
"description": "Data marketplace for ocean.",
"version": "0.0.1",
"license": "Apache-2.0",
"scripts": {
@ -18,11 +18,15 @@
"storybook:build": "build-storybook -c .storybook -o public/storybook"
},
"dependencies": {
"@oceanprotocol/react": "0.0.3",
"@oceanprotocol/squid": "^2.1.1",
"@oceanprotocol/art": "^2.2.0",
"@oceanprotocol/react": "0.0.11",
"@oceanprotocol/squid": "^2.2.0",
"@oceanprotocol/typographies": "^0.1.0",
"@sindresorhus/slugify": "^1.0.0",
"@tippyjs/react": "^4.0.2",
"@types/classnames": "^2.2.10",
"axios": "^0.19.2",
"classnames": "^2.2.6",
"date-fns": "^2.11.0",
"dotenv": "^8.2.0",
"filesize": "^6.1.0",
@ -33,6 +37,7 @@
"nprogress": "^0.2.0",
"numeral": "^2.0.6",
"react": "^16.13.1",
"react-data-table-component": "^6.9.2",
"react-datepicker": "^2.14.0",
"react-dom": "^16.13.1",
"react-dotdotdot": "^1.3.1",
@ -41,6 +46,7 @@
"react-markdown": "^4.3.1",
"react-paginate": "^6.3.2",
"react-rating": "^2.0.4",
"react-responsive-modal": "^5.0.2",
"react-toastify": "^5.5.0",
"shortid": "^2.2.15",
"slugify": "^1.4.0",
@ -84,7 +90,7 @@
},
"repository": {
"type": "git",
"url": "https://github.com/oceanprotocol/dexfreight"
"url": "https://github.com/oceanprotocol/market"
},
"engines": {
"node": ">=12"

View File

@ -1,7 +1,7 @@
module.exports = {
title: 'Data Marketplace',
title: 'Ocean Market',
description: `A marketplace to find and publish open data sets in the Ocean Network.`,
url: 'https://dexfreight.oceanprotocol.com',
url: 'https://market.oceanprotocol.now.sh/',
copyright:
'All Rights Reserved. Powered by [Ocean Protocol](https://oceanprotocol.com)',
refundPolicy: [
@ -26,6 +26,10 @@ module.exports = {
{
name: 'Publish',
link: '/publish'
},
{
name: 'Transactions',
link: '/transactions'
}
]
}

View File

@ -18,19 +18,17 @@ export interface Sample {
export declare type AccessType = 'Download' | 'Compute'
export interface AdditionalInformationDexFreight extends AdditionalInformation {
description: string // required for dexFreight
categories: [string] // required for dexFreight, lock to one category only
export interface AdditionalInformationMarket extends AdditionalInformation {
description: string
links?: Sample[] // redefine existing key, cause not specific enough in Squid
deliveryType: DeliveryType
termsAndConditions: boolean
dateRange?: [string, string]
granularity?: Granularity
supportName?: string
supportEmail?: string
access: AccessType
}
export interface MetaDataDexFreight extends MetaData {
additionalInformation: AdditionalInformationDexFreight
export interface MetaDataMarket extends MetaData {
additionalInformation: AdditionalInformationMarket
}

View File

@ -0,0 +1,6 @@
.customOverlay {
}
.customModal {
border-radius: 15px;
margin: auto;
}

View File

@ -0,0 +1,35 @@
import React from 'react'
import styles from './BaseDialog.module.css'
import { Modal } from 'react-responsive-modal'
export default function BaseDialog({
open,
title,
onClose,
children,
disableClose,
actions,
...other
}: {
open: boolean
title: string
onClose: () => void
children: React.ReactNode
disableClose?: boolean
actions?: any
}) {
return (
<Modal
open={open}
onClose={onClose}
classNames={{
overlay: styles.customOverlay,
modal: styles.customModal
}}
{...other}
>
<h2>{title}</h2>
<div>{children}</div>
</Modal>
)
}

View File

@ -0,0 +1,5 @@
.help {
font-size: var(--font-size-small);
color: var(--brand-grey-light);
margin-top: var(--spacer) / 4;
}

View File

@ -0,0 +1,8 @@
import React from 'react'
import styles from './Help.module.css'
const FormHelp = ({ children }: { children: string }) => (
<div className={styles.help}>{children}</div>
)
export default FormHelp

View File

@ -0,0 +1,171 @@
.inputWrap,
.inputWrapSearch {
background: var(--brand-gradient);
border-radius: var(--border-radius);
padding: 2px;
display: flex;
position: relative;
}
.inputWrap .isFocused,
.inputWrapSearch .isFocused {
background: var(--brand-black);
}
.inputWrap > div,
.inputWrap > div > div,
.inputWrapSearch > div,
.inputWrapSearch > div > div {
width: 100%;
}
.inputWrapSearch,
.input {
padding-left: var(--spacer) * 1.5;
}
.inputWrapSearch svg {
position: absolute;
left: var(--spacer) / 2;
width: 1.25rem;
height: 1.25rem;
top: 50%;
margin-top: -0.6rem;
fill: rgba(var(--brand-grey-light), 0.7);
}
.input,
.select {
font-size: var(--font-size-base);
font-family: var(--font-family-base);
font-weight: var(--font-weight-bold);
color: var(--brand-black);
border: none;
box-shadow: none;
width: 100%;
background: var(--brand-white);
padding: var(--spacer) / 3;
margin: 0;
border-radius: var(--border-radius);
transition: 0.2s ease-out;
min-height: 43px;
appearance: none;
}
.input:focus,
.select:focus {
border: none;
box-shadow: none;
outline: 0;
}
.select::placeholder,
.input::placeholder {
font-family: var(--font-family-base);
font-size: var(--font-size-base);
color: var(--brand-grey-light);
font-weight: var(--font-weight-base);
transition: 0.2s ease-out;
opacity: 0.7;
}
.select[readonly],
.input[readonly],
.select[disabled],
.input[disabled] {
background-color: var(--brand-grey-lighter);
cursor: not-allowed;
pointer-events: none;
}
.select {
composes: input;
height: 43px;
padding-right: 3rem;
border: 0;
background-image: linear-gradient(
45deg,
transparent 50%,
var(--brand-purple 50%)
),
linear-gradient(135deg, var(--brand-purple) 50%, transparent 50%),
linear-gradient(
to right,
var(--brand-pink) 1px,
lighten(var(--brand-grey-lighter), 5%) 2px,
lighten(var(--brand-grey-lighter), 5%)
);
background-position: calc(100% - 18px) calc(1rem + 5px),
calc(100% - 13px) calc(1rem + 5px), 100% 0;
background-size: 5px 5px, 5px 5px, 2.5rem 3rem;
background-repeat: no-repeat;
}
.select:focus {
outline: 0;
font-family: var(--font-family-base);
}
.radioGroup {
margin-top: var(--spacer) / 2;
margin-bottom: -2%;
@media screen and (min-width: var(--break-point--small)) {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
}
}
.radioWrap {
position: relative;
padding: var(--spacer) / 2;
text-align: center;
display: flex;
align-items: center;
margin-bottom: 2%;
@media screen and (min-width: var(--break-point--small)) {
flex: 0 0 49%;
}
}
.radio:checked + label {
border-color: var(--brand-pink);
}
.radioLabel {
margin: 0;
padding: 0;
font-weight: var(--font-weight-bold);
font-size: var(--font-size-small);
line-height: 1.2;
border: 2px solid var(--brand-grey-lighter);
border-radius: 0.2rem;
position: absolute;
left: 0;
right: 0;
top: 0;
bottom: 0;
color: var(--brand-grey);
text-align: left;
padding-left: 2.5rem;
display: flex;
align-items: center;
}
.inputSmall {
composes: input;
font-size: var(--font-size-small);
min-height: 32px;
padding: var(--spacer) / 4;
}
.inputSmall::placeholder {
font-size: var(--font-size-small);
}
.selectSmall {
composes: select;
height: 32px;
padding-right: 2rem;
background-position: calc(100% - 14px) 1rem, calc(100% - 9px) 1rem, 100% 0;
background-size: 5px 5px, 5px 5px, 2rem 3rem;
}

View File

@ -0,0 +1,213 @@
import cx from 'classnames'
import React, { PureComponent, FormEvent, ChangeEvent } from 'react'
import slugify from '@sindresorhus/slugify'
import DatePicker from 'react-datepicker'
import Help from './Help'
import Label from './Label'
import Row from './Row'
import InputGroup from './InputGroup'
import styles from './Input.module.css'
interface InputProps {
name: string
label: string
placeholder?: string
required?: boolean
help?: string
tag?: string
type?: string
options?: string[]
additionalComponent?: any
value?: string
onChange?(
event:
| FormEvent<HTMLInputElement>
| ChangeEvent<HTMLInputElement>
| ChangeEvent<HTMLSelectElement>
| ChangeEvent<HTMLTextAreaElement>
): void
rows?: number
group?: any
multiple?: boolean
pattern?: string
}
interface InputState {
isFocused: boolean
dateCreated?: Date
}
export default class Input extends PureComponent<InputProps, InputState> {
public state: InputState = {
isFocused: false,
dateCreated: new Date()
}
public inputWrapClasses() {
if (this.props.type === 'search') {
return styles.inputWrapSearch
} else if (this.props.type === 'search' && this.state.isFocused) {
return cx(styles.inputWrapSearch, styles.isFocused)
} else if (this.state.isFocused && this.props.type !== 'search') {
return cx(styles.inputWrap, styles.isFocused)
} else {
return styles.inputWrap
}
}
public handleFocus = () => {
this.setState({ isFocused: !this.state.isFocused })
}
private handleDateChange = (date: Date) => {
this.setState({ dateCreated: date })
const event = {
currentTarget: {
name: 'dateCreated',
value: date
}
}
this.props.onChange!(event as any) // eslint-disable-line @typescript-eslint/no-non-null-assertion
}
public InputComponent = () => {
const { type, options, group, name, required, onChange, value } = this.props
const wrapClass = this.inputWrapClasses()
switch (type) {
case 'select':
return (
<div className={wrapClass}>
<select
id={name}
className={styles.select}
name={name}
required={required}
onFocus={this.handleFocus}
onBlur={this.handleFocus}
onChange={onChange}
value={value}
>
<option value="">---</option>
{options &&
options
.sort((a, b) => a.localeCompare(b))
.map((option: string, index: number) => (
<option key={index} value={option}>
{option}
</option>
))}
</select>
</div>
)
case 'textarea':
return (
<div className={wrapClass}>
<textarea
id={name}
className={styles.input}
onFocus={this.handleFocus}
onBlur={this.handleFocus}
{...this.props}
/>
</div>
)
case 'radio':
case 'checkbox':
return (
<div className={styles.radioGroup}>
{options &&
options.map((option: string, index: number) => (
<div className={styles.radioWrap} key={index}>
<input
className={styles.radio}
id={slugify(option)}
type={type}
name={name}
value={slugify(option)}
/>
<label
className={styles.radioLabel}
htmlFor={slugify(option)}
>
{option}
</label>
</div>
))}
</div>
)
case 'date':
return (
<div className={wrapClass}>
<DatePicker
selected={this.state.dateCreated}
onChange={this.handleDateChange}
className={styles.input}
onFocus={this.handleFocus}
onBlur={this.handleFocus}
id={name}
name={name}
/>
</div>
)
default:
return (
<div className={wrapClass}>
{group ? (
<InputGroup>
<input
id={name}
type={type || 'text'}
className={styles.input}
onFocus={this.handleFocus}
onBlur={this.handleFocus}
{...this.props}
/>
{group}
</InputGroup>
) : (
<input
id={name}
type={type || 'text'}
className={styles.input}
onFocus={this.handleFocus}
onBlur={this.handleFocus}
{...this.props}
/>
)}
{/* {type === 'search' && <SearchIcon />} */}
</div>
)
}
}
public render() {
const {
name,
label,
required,
help,
additionalComponent,
multiple
} = this.props
return (
<Row>
<Label htmlFor={name} required={required}>
{label}
</Label>
<this.InputComponent />
{help && <Help>{help}</Help>}
{multiple && 'hello'}
{additionalComponent && additionalComponent}
</Row>
)
}
}

View File

@ -0,0 +1,35 @@
.inputGroup {
width: 100%;
@media screen and (min-width: $break-point--small) {
display: flex;
}
}
.inputGroup > input {
@media screen and (min-width: $break-point--small) {
width: 75%;
border-top-right-radius: 0;
border-bottom-right-radius: 0;
}
}
.inputGroup > button {
width: 100%;
position: absolute;
left: 0;
bottom: -120%;
@media screen and (min-width: $break-point--small) {
position: relative;
bottom: auto;
width: 25%;
height: 100%;
border-top-left-radius: 0;
border-bottom-left-radius: 0;
box-shadow: none;
}
}
.inputGroup > button:hover,
.inputGroup > button:focus {
transform: none;
}

View File

@ -0,0 +1,8 @@
import React from 'react'
import styles from './InputGroup.module.css'
const InputGroup = ({ children }: { children: any }) => (
<div className={styles.inputGroup}>{children}</div>
)
export default InputGroup

View File

@ -0,0 +1,16 @@
.label .required {
color: var(--brand-grey);
font-size: var(--font-size-base);
font-family: var(--font-family-title);
line-height: 1.2;
display: block;
margin-bottom: var(--spacer) / 6;
}
.required:after {
content: '*';
font-size: var(--font-size-base);
color: var(--brand-grey-light);
display: inline-block;
margin-left: 0.1rem;
}

View File

@ -0,0 +1,22 @@
import React from 'react'
import styles from './Label.module.css'
const Label = ({
required,
children,
...props
}: {
required?: boolean
children: string
htmlFor: string
}) => (
<label
className={required ? styles.required : styles.label}
title={required ? 'Required' : ''}
{...props}
>
{children}
</label>
)
export default Label

View File

@ -0,0 +1,3 @@
.row {
margin-bottom: var(--spacer);
}

View File

@ -0,0 +1,8 @@
import React from 'react'
import styles from './Row.module.css'
const Row = ({ children }: { children: any }) => (
<div className={styles.row}>{children}</div>
)
export default Row

View File

@ -9,3 +9,8 @@
color: var(--color-secondary);
font-size: var(--font-size-small);
}
.small {
transform: scale(0.8);
transform-origin: left 80%;
}

View File

@ -4,12 +4,16 @@ import styles from './Price.module.css'
export default function Price({
price,
className
className,
small
}: {
price: string
className?: string
small?: boolean
}) {
const classes = className ? `${styles.price} ${className}` : styles.price
const classes = small
? `${styles.price} ${styles.small} ${className}`
: `${styles.price} ${className}`
const isFree = price === '0'
const displayPrice = isFree ? (
'Free'

View File

@ -0,0 +1,25 @@
import React from 'react'
import Eye from '../../../images/eye.svg'
import Button from '../Button'
import Tooltip from '../Tooltip'
import { ComputeItem } from '@oceanprotocol/react'
export declare type ActionsCellProps = {
handleOnClickViewJobDetails?: (computeItem: ComputeItem) => void
}
export default function ActionsCell({
handleOnClickViewJobDetails
}: ActionsCellProps) {
return (
<>
{handleOnClickViewJobDetails && (
<Tooltip content="View job details">
<Button onClick={handleOnClickViewJobDetails}>
<Eye />
</Button>
</Tooltip>
)}
</>
)
}

View File

@ -0,0 +1,6 @@
import React from 'react'
import Time from '../Time'
export default function DateCell({ date }: { date: any }) {
return date && <Time date={date} />
}

View File

@ -0,0 +1,11 @@
import React from 'react'
import Time from '../Time'
import Link from 'next/link'
export default function DdoLinkCell({ id, name }: { id: any; name: any }) {
return (
<Link href="/asset/[did]" as={`/asset/${id}`} passHref>
<a>{name}</a>
</Link>
)
}

View File

@ -0,0 +1,35 @@
import React from 'react'
import DataTable from 'react-data-table-component'
export declare type AssetTablePagination = {
count: number
rowsPerPage: number
page: number
handleChangePage: (
event: React.MouseEvent<HTMLButtonElement> | null,
page: number
) => void
handleChangeRowsPerPage: React.ChangeEventHandler<
HTMLTextAreaElement | HTMLInputElement
>
}
export default function Table({
columns,
data,
pagination
}: {
columns: any
data: any
pagination?: AssetTablePagination
}) {
return (
<div>
{data && data.length ? (
<DataTable noHeader columns={columns} data={data} />
) : (
<div>No Data Sets Yet.</div>
)}
</div>
)
}

View File

View File

@ -0,0 +1,24 @@
import React, { ReactElement, forwardRef } from 'react'
import Tippy from '@tippyjs/react'
export default function Tooltip({
content,
children
}: {
content: string
children: ReactElement
}) {
return (
<Tippy content={content}>
<CustomWrapper>{children}</CustomWrapper>
</Tippy>
)
}
// Forward ref for Tippy.js
// eslint-disable-next-line
const CustomWrapper = forwardRef(
({ children }: { children: ReactElement }, ref: any) => {
return <div ref={ref}>{children}</div>
}
)

View File

@ -8,7 +8,7 @@
font-size: var(--font-size-small);
height: 100%;
color: var(--brand-grey-dark);
position: relative;
/* for sticking footer to bottom */
display: flex;
flex-direction: column;
@ -62,3 +62,15 @@ p.copyright {
text-align: center;
margin-top: calc(var(--spacer) / 3);
}
.accessLabel {
font-size: var(--font-size-small);
width: auto;
position: absolute;
top: 0;
right: 0;
color: var(--brand-black);
background: var(--brand-grey-lighter);
padding: 0.1px 0.5px 0.1px 0.5px;
border-radius: 2px;
}

View File

@ -3,8 +3,8 @@ import { DDO } from '@oceanprotocol/squid'
import Link from 'next/link'
import Dotdotdot from 'react-dotdotdot'
import {
AdditionalInformationDexFreight,
MetaDataDexFreight
AdditionalInformationMarket,
MetaDataMarket
} from '../../@types/MetaData'
import { findServiceByType } from '../../utils'
import Tags from '../atoms/Tags'
@ -24,23 +24,28 @@ const AssetTeaser: React.FC<AssetTeaserProps> = ({ ddo }: AssetTeaserProps) => {
let copyrightHolder
let tags
let categories
let access
if (attributes && attributes.additionalInformation) {
;({
description,
copyrightHolder,
tags,
categories
} = attributes.additionalInformation as AdditionalInformationDexFreight)
categories,
access
} = attributes.additionalInformation as AdditionalInformationMarket)
}
const { curation } = attributes as MetaDataDexFreight
const { curation } = attributes as MetaDataMarket
return (
<article className={styles.teaser}>
<Link href="/asset/[did]" as={`/asset/${ddo.id}`}>
<a className={styles.link}>
<h1 className={styles.title}>{name}</h1>
{access === 'Compute' && (
<div className={styles.accessLabel}>{access}</div>
)}
<Rating curation={curation} readonly />
<div className={styles.content}>

View File

@ -0,0 +1,82 @@
import React, { useState, useEffect } from 'react'
import { DDO, Ocean } from '@oceanprotocol/squid'
import { useRouter } from 'next/router'
import { findServiceByType, redeploy } from '../../utils'
import Button from '../atoms/Button'
import BaseDialog from '../atoms/BaseDialog'
import { useOcean } from '@oceanprotocol/react'
const content = [
'You are about to delete your Data Set.',
'Your Data Set is being deleted...',
'You have deleted your Data Set ',
'Something happened... Your Data Set cannot be deleted'
]
export default function DeleteAction({ ddo }: { ddo: DDO }) {
const { ocean, accountId } = useOcean()
const isOwner = ddo.publicKey[0].owner === accountId
const router = useRouter()
const [isModal, setIsModal] = useState(false)
const [status, setStatus] = useState(0) // 0-confirmation, 1-deleting, 2-success, 3-error
const { attributes } = findServiceByType(ddo, 'metadata')
useEffect(() => {
let tId: number
if (status === 2) {
tId = window.setTimeout(() => {
router.push(`/explore`)
}, 1000)
}
return () => {
clearTimeout(tId)
}
}, [status])
if (!accountId || !ocean || !isOwner) return null
async function handleDeleteAction() {
if (!ocean) return
setStatus(1)
setIsModal(true)
try {
const consumerAddress = (await ocean.accounts.list())[0]
await ocean.assets.retire(ddo.id, consumerAddress)
// trigger new live deployment
await redeploy()
setStatus(2)
} catch (error) {
// TODO: handle error
console.log(error)
setStatus(3)
}
}
const handleCancel = () => {
setIsModal(false)
setStatus(0)
}
const handleOpenConfirmation = () => setIsModal(true)
return (
<>
<Button onClick={handleOpenConfirmation}>Delete</Button>
<BaseDialog
title={`Delete ${attributes.main.name}`}
open={isModal}
onClose={() => setIsModal(false)}
>
{content[status]}
<footer>
<Button onClick={handleDeleteAction}>Confirm</Button>
<Button onClick={handleCancel}>Cancel</Button>
</footer>
</BaseDialog>
</>
)
}

View File

@ -0,0 +1,14 @@
.metaGrid {
border-radius: var(--border-radius);
display: grid;
gap: calc(var(--spacer) / 2);
grid-template-columns: 1fr 1fr;
}
.metaRow {
padding-top: calc(var(--spacer) / 2);
border-radius: var(--border-radius);
display: grid;
gap: calc(var(--spacer) / 2);
grid-template-columns: auto;
}

View File

@ -0,0 +1,80 @@
import React from 'react'
import { ComputeItem } from '@oceanprotocol/react'
import BaseDialog from '../atoms/BaseDialog'
import { findServiceByType } from '../../utils'
import styles from './JobDetailsDialog.module.css'
import MetaItem from '../templates/AssetDetails/MetaItem'
import Time from '../atoms/Time'
import shortid from 'shortid'
import Link from 'next/link'
export default function JobDetailsDialog({
computeItem,
isOpen,
onClose
}: {
computeItem: ComputeItem | undefined
isOpen: boolean
onClose: () => void
}) {
if (!computeItem) return null
const { attributes } = findServiceByType(computeItem.ddo, 'metadata')
const { name } = attributes.main
const {
dateCreated,
dateFinished,
statusText,
jobId,
resultsUrls,
algorithmLogUrl
} = computeItem.job
return (
<BaseDialog title={name} open={isOpen} onClose={onClose}>
<div className={styles.metaGrid}>
<MetaItem title="Date Created" content={<Time date={dateCreated} />} />
<MetaItem title="Status" content={statusText} />
<MetaItem
title="Date Finished"
content={<Time date={dateFinished} />}
/>
<MetaItem title="Job Id" content={jobId} />
</div>
<div className={styles.metaRow}>
{resultsUrls && (
<MetaItem
title="Results"
content={resultsUrls.map((url: string) => (
<Link href={url} key={shortid.generate()} passHref>
<a>{url}</a>
</Link>
))}
/>
)}
{algorithmLogUrl && (
<MetaItem
title="Algorithm Log"
content={
<Link href={algorithmLogUrl} key={shortid.generate()} passHref>
<a>{algorithmLogUrl}</a>
</Link>
}
/>
)}
<MetaItem
title="Data Set"
content={
<Link
href="/asset/[did]"
as={`/asset/${computeItem.ddo.id}`}
passHref
>
<a>{name}</a>
</Link>
}
/>
</div>
</BaseDialog>
)
}

View File

@ -7,7 +7,7 @@ import {
PublishFormDataInterface
} from '../../../models/PublishForm'
import useStoredValue from '../../../hooks/useStoredValue'
import { MetaDataDexFreight } from '../../../@types/MetaData'
import { MetaDataMarket } from '../../../@types/MetaData'
import { File, MetaData } from '@oceanprotocol/squid'
import { isBrowser, toStringNoMS } from '../../../utils'
import { toast } from 'react-toastify'
@ -16,6 +16,10 @@ import styles from './PublishForm.module.css'
import utils from 'web3-utils'
import AssetModel from '../../../models/Asset'
import { useWeb3, useOcean } from '@oceanprotocol/react'
import {
Service,
ServiceCompute
} from '@oceanprotocol/squid/dist/node/ddo/Service'
declare type PublishFormProps = {}
@ -40,7 +44,7 @@ export function clearFilesData() {
export function transformPublishFormToMetadata(
data: PublishFormDataInterface
): MetaDataDexFreight {
): MetaDataMarket {
const currentTime = toStringNoMS(new Date())
const {
@ -49,17 +53,16 @@ export function transformPublishFormToMetadata(
author,
license,
summary,
category,
holder,
keywords,
termsAndConditions,
granularity,
supportName,
supportEmail,
dateRange
dateRange,
access
} = data
const metadata: MetaDataDexFreight = {
const metadata: MetaDataMarket = {
main: {
...AssetModel.main,
name: title,
@ -74,13 +77,12 @@ export function transformPublishFormToMetadata(
additionalInformation: {
...AssetModel.additionalInformation,
description: summary,
categories: [category],
copyrightHolder: holder,
tags: keywords?.split(','),
termsAndConditions,
granularity,
supportName,
supportEmail
supportEmail,
access: access || 'Download'
},
// ------- curation -------
curation: AssetModel.curation
@ -101,8 +103,8 @@ export function transformPublishFormToMetadata(
const PublishForm: React.FC<PublishFormProps> = () => {
const [buttonDisabled, setButtonDisabled] = useState(false)
const { web3, web3Connect } = useWeb3()
const { ocean } = useOcean()
const { web3Connect } = useWeb3()
const { ocean, account } = useOcean()
const router = useRouter()
const [data, updateData] = useStoredValue(
PUBLISH_FORM_LOCAL_STORAGE_KEY,
@ -136,22 +138,51 @@ const PublishForm: React.FC<PublishFormProps> = () => {
}
if (ocean) {
const asset = await ocean.assets.create(
(transformPublishFormToMetadata(formData) as unknown) as MetaData,
(await ocean.accounts.list())[0]
)
const metadata = transformPublishFormToMetadata(formData)
// if services array stays empty, the default access service
// will be created by squid-js
let services: Service[] = []
if (metadata.additionalInformation.access === 'Compute') {
const computeService: ServiceCompute = await ocean.compute.createComputeServiceAttributes(
account,
metadata.main.price,
// Note: a hack without consequences.
// Will make metadata.main.datePublished (automatically created by Aquarius)
// go out of sync with this service.main.datePublished.
toStringNoMS(new Date(Date.now()))
)
services = [computeService]
}
console.log(metadata as MetaData)
try {
const asset = await ocean.assets.create(
metadata as MetaData,
account,
services
)
// Reset the form to initial values
updateData(publishFormData)
clearFilesData()
// User feedback and redirect
toast.success('asset created successfully', {
className: styles.success
})
toast.dismiss(submittingToast)
router.push(`/asset/${asset.id}`)
} catch (e) {
console.log(e)
} finally {
setButtonDisabled(false)
}
// Reset the form to initial values
updateData(publishFormData)
clearFilesData()
setButtonDisabled(false)
// User feedback and redirect
toast.success('asset created successfully', {
className: styles.success
})
toast.dismiss(submittingToast)
router.push(`/asset/${asset.id}`)
}
}

View File

@ -1,12 +0,0 @@
.optionItem {
margin-bottom: calc(var(--spacer) / 4);
padding-left: 1.5rem;
}
.optionItem label {
display: block;
}
.optionItem input {
margin-left: -1.5rem;
}

View File

@ -1,32 +0,0 @@
import React from 'react'
import useCategoriesQueryParams from '../../hooks/useCategoriesQueryParams'
import SearchFilterSection from '../atoms/SearchFilterSection'
import Checkbox from '../atoms/Checkbox'
import { CATEGORIES } from '../../models/PublishForm'
import styles from './SearchCategoriesFilter.module.css'
const SearchCategoriesFilter = () => {
const { selectedCategories, toggleCategory } = useCategoriesQueryParams(
CATEGORIES
)
return (
<SearchFilterSection title="Filter by type">
<ul>
{CATEGORIES.map(category => (
<li key={category} className={styles.optionItem}>
<Checkbox
name={category}
checked={selectedCategories.includes(category)}
onChange={() => toggleCategory(category)}
label={category}
/>
</li>
))}
</ul>
</SearchFilterSection>
)
}
export default SearchCategoriesFilter

View File

@ -1,10 +1,7 @@
.jobButtonWrapper {
margin-top: var(--spacer);
}
.selectType {
width: 100%;
margin-bottom: var(--spacer);
}
.feedback {
width: 100%;
margin-top: var(--spacer);
@ -13,9 +10,9 @@
}
.compute {
composes: box from '../atoms/Box.module.css';
display: flex;
flex-wrap: wrap;
padding: calc(var(--spacer) * 1.5);
}
.compute button {
margin-left: var(--spacer);
@ -24,14 +21,15 @@
margin-left: 0px;
}
.price {
padding-bottom: calc(var(--spacer) * 1.5);
font-size: var(--font-size-h2);
/* padding-bottom: var(--spacer); */
}
.info {
display: flex;
flex-direction: column;
width: 100%;
padding-top: calc(var(--spacer) * 0.5);
/* padding-top: calc(var(--spacer) * 0.5);
padding-bottom: var(--spacer);
border-top: 1px solid var(--color-secondary);
border-top: 1px solid var(--color-secondary); */
}

View File

@ -1,10 +1,9 @@
import React, { useState, useEffect } from 'react'
import { DDO, MetaDataAlgorithm, Ocean, DID } from '@oceanprotocol/squid'
import { DDO, Ocean, Logger } from '@oceanprotocol/squid'
import { ServiceMetadata } from '@oceanprotocol/squid/dist/node/ddo/Service'
import { fromWei } from 'web3-utils'
import compareAsBN, { Comparisson } from '../../utils/compareAsBN'
import Loader from '../atoms/Loader'
import { config } from '../../config/ocean'
import Web3Feedback from '../molecules/Web3Feedback'
import Dropzone from '../atoms/Dropzone'
import Price from '../atoms/Price'
@ -14,8 +13,9 @@ import {
useCompute,
readFileContent
} from '@oceanprotocol/react'
import styles from './Consume.module.css'
import styles from './Compute.module.css'
import Button from '../atoms/Button'
import Input from '../atoms/Input/Input'
export default function Compute({
ddo,
@ -27,12 +27,11 @@ export default function Compute({
ocean: Ocean | null
}) {
if (!ddo) return null
const { compute, computeStep, computeStepText } = useCompute()
const [isJobStarting, setIsJobStarting] = useState(false)
const [step, setStep] = useState(99)
const [error, setError] = useState('')
const [isBalanceSufficient, setIsBalanceSufficient] = useState(false)
const { compute, isLoading, computeStepText, computeError } = useCompute()
const [isJobStarting, setIsJobStarting] = useState(false)
const [, setError] = useState('')
const [isBalanceSufficient, setIsBalanceSufficient] = useState(false)
const [computeType, setComputeType] = useState('')
const [computeContainer, setComputeContainer] = useState({
entrypoint: '',
@ -48,7 +47,7 @@ export default function Compute({
const isFree = price === '0'
const [isTermsAgreed, setIsTermsAgreed] = useState(false)
const [isTermsAgreed, setIsTermsAgreed] = useState(true)
const isComputeButtonDisabled =
isJobStarting ||
file === null ||
@ -86,7 +85,9 @@ export default function Compute({
setIsJobStarting(true)
setIsPublished(false)
setError('')
// compute(ddo.id, algorithmRawCode, computeContainer)
await compute(ddo.id, algorithmRawCode, computeContainer)
setIsPublished(true)
setFile(null)
} catch (error) {
@ -96,31 +97,28 @@ export default function Compute({
setIsJobStarting(false)
}
function onCheck(event: any) {
console.log(event, event.target.checked)
setIsTermsAgreed(event.target.checked)
}
return (
<div className={styles.compute}>
<Price price={fromWei(price)} className={styles.price} />
<Price price={price} className={styles.price} />
<div className={styles.info}>
<div className={styles.selectType}>
{/* <input
type="search"
className={large ? `${styles.input} ${styles.large}` : styles.input}
placeholder={placeholder || 'What are you looking for?'}
value={value}
onChange={e => handleChange(e)}
required
/> */}
<Input
type="select"
name="algorithm"
label="Select image to run the algorithm"
placeholder=""
value={computeType}
options={computeOptions.map(x => x.name)}
onChange={handleSelectChange}
/>
</div>
<div>
<Dropzone multiple={false} handleOnDrop={onDrop} />
<div className={styles.jobButtonWrapper}>
<Button
primary
onClick={() => startJob()}
disabled={isComputeButtonDisabled}
>
@ -130,8 +128,10 @@ export default function Compute({
{/* <TermsCheckbox onChange={onCheck} /> */}
</div>
{isJobStarting && <Loader message={computeStepText} />}
{error !== '' && <div className={styles.feedback}>{error}</div>}
{isLoading && <Loader message={computeStepText} />}
{computeError !== undefined && (
<div className={styles.feedback}>{computeError}</div>
)}
{isPublished && (
<div className={styles.feedback}>
<p>Your job started! Watch the progress in the history page.</p>

View File

@ -6,7 +6,7 @@ import compareAsBN, { Comparisson } from '../../utils/compareAsBN'
import Button from '../atoms/Button'
import File from '../atoms/File'
import Price from '../atoms/Price'
import { MetaDataDexFreight } from '../../@types/MetaData'
import { MetaDataMarket } from '../../@types/MetaData'
import Web3Feedback from '../molecules/Web3Feedback'
import styles from './Consume.module.css'
import Loader from '../atoms/Loader'
@ -20,7 +20,7 @@ export default function Consume({ ddo }: { ddo: DDO | undefined }) {
const { consume, consumeStepText, isLoading } = useConsume()
const { attributes } = findServiceByType(ddo, 'metadata')
const { price } = attributes.main
const file = (attributes as MetaDataDexFreight).main.files[0]
const file = (attributes as MetaDataMarket).main.files[0]
const isFree = price === '0'
const isBalanceSufficient =
isFree ||

View File

@ -0,0 +1,83 @@
import React, { useEffect, useState } from 'react'
import Loader from '../atoms/Loader'
import {
useOcean,
OceanConnectionStatus,
useSearch
} from '@oceanprotocol/react'
import Table from '../atoms/Table'
import Price from '../atoms/Price'
import { fromWei } from 'web3-utils'
import DateCell from '../atoms/Table/DateCell'
import DdoLinkCell from '../atoms/Table/DdoLinkCell'
import { DDO, MetaDataMain } from '@oceanprotocol/squid'
import { findServiceByType } from '../../utils'
import { config } from '../../config/ocean'
const consumedColumns = [
{
name: 'Published',
selector: 'published',
sortable: true,
cell: function getCell(row: any) {
return <DateCell date={row.published} />
}
},
{
name: 'Name',
selector: 'name',
sortable: true,
cell: function getCell(row: any) {
return <DdoLinkCell id={row.id} name={row.name} />
}
},
{
name: 'Price',
selector: 'price',
sortable: true,
cell: function getCell(row: any) {
return <Price price={fromWei(row.price)} small />
}
}
]
export default function ConsumedList() {
const { ocean, status, accountId, account } = useOcean()
const [consumedList, setConsumedList] = useState<any>([])
const { getConsumedList } = useSearch()
const [isLoading, setIsLoading] = useState(false)
useEffect(() => {
async function getConsumed() {
if (!accountId || !ocean || status !== OceanConnectionStatus.CONNECTED)
return
setIsLoading(true)
const consumedItems = await getConsumedList()
if (!consumedItems) return
const data = consumedItems.map(ddo => {
const { attributes } = findServiceByType(ddo, 'metadata')
const { name, price, datePublished } = attributes.main as MetaDataMain
return {
published: datePublished,
name: name,
price: price
}
})
setConsumedList(data)
setIsLoading(false)
}
getConsumed()
}, [accountId, ocean, status])
return isLoading ? (
<Loader />
) : account && ocean ? (
<Table data={consumedList} columns={consumedColumns} />
) : (
<div>Connect your wallet to see your consumed data sets.</div>
)
}

View File

@ -0,0 +1,148 @@
import React, { useEffect, useState } from 'react'
import Loader from '../atoms/Loader'
import {
useOcean,
OceanConnectionStatus,
useSearch,
ComputeItem
} from '@oceanprotocol/react'
import Price from '../atoms/Price'
import { fromWei } from 'web3-utils'
import { findServiceByType } from '../../utils'
import Table from '../atoms/Table'
import Button from '../atoms/Button'
import { MetaDataMain, Logger } from '@oceanprotocol/squid'
import DateCell from '../atoms/Table/DateCell'
import DdoLinkCell from '../atoms/Table/DdoLinkCell'
import { config } from '../../config/ocean'
import shortid from 'shortid'
import ActionsCell from '../atoms/Table/ActionsCell'
import Tooltip from '../atoms/Tooltip'
import Tippy from '@tippyjs/react'
import JobDetailsDialog from '../molecules/JobDetailsDialog'
const columns = [
{
name: 'Created',
selector: 'dateCreated',
sortable: true,
cell: function getCell(row: any) {
return <DateCell date={row.dateCreated} />
}
},
{
name: 'Finished',
selector: 'dateFinished',
sortable: true,
cell: function getCell(row: any) {
return <DateCell date={row.dateFinished} />
}
},
{
name: 'Name',
selector: 'name',
sortable: true,
cell: function getCell(row: any) {
return <DdoLinkCell id={row.id} name={row.name} />
}
},
{
name: 'Price',
selector: 'price',
sortable: true,
cell: function getCell(row: any) {
return <Price price={fromWei(row.price)} small />
}
},
{
name: 'Status',
selector: 'status'
},
{
name: 'Actions',
selector: 'actions',
cell: function getCell(row: any) {
return (
<ActionsCell handleOnClickViewJobDetails={row.onClickViewJobDetails} />
)
}
}
]
export default function JobsList() {
const { ocean, status, accountId } = useOcean()
const [jobList, setJobList] = useState<any[]>([])
const [isLoading, setIsLoading] = useState(false)
const [userAgreed, setUserAgreed] = useState(false)
const { getComputeItems } = useSearch()
const [isOpen, setIsOpen] = useState(false)
const [detailsComputeItem, setDetailsComputeItem] = useState<ComputeItem>()
const onClickViewJobDetails = (compute: ComputeItem) => {
setDetailsComputeItem(compute)
setIsOpen(true)
}
const dialogClose = () => {
setIsOpen(false)
}
const getJobs = async () => {
if (!accountId || !ocean || status !== OceanConnectionStatus.CONNECTED)
return
setIsLoading(true)
setUserAgreed(true)
try {
const computeItems = await getComputeItems()
if (!computeItems) return
const data = computeItems.map(item => {
const { attributes } = findServiceByType(item.ddo, 'metadata')
const { name, price } = attributes.main as MetaDataMain
return {
dateCreated: item.job.dateCreated,
dateFinished: item.job.dateFinished,
status: item.job.statusText,
name: name,
price: price,
did: item.ddo.id,
id: shortid.generate(),
onClickViewJobDetails: () => onClickViewJobDetails(item)
}
})
setJobList(data)
setIsLoading(false)
} catch (err) {
Logger.error(err)
// TODO: no error handling
} finally {
setIsLoading(false)
}
}
return isLoading ? (
<Loader />
) : accountId && ocean ? (
userAgreed ? (
<>
<JobDetailsDialog
computeItem={detailsComputeItem}
isOpen={isOpen}
onClose={dialogClose}
/>
<Table data={jobList} columns={columns} />
</>
) : (
<>
<div>
<Button primary onClick={getJobs}>
Sign to retrieve jobs
</Button>
</div>
</>
)
) : (
<div>Connect your wallet to see your compute jobs.</div>
)
}

View File

@ -0,0 +1,100 @@
import React, { useEffect, useState } from 'react'
import Loader from '../atoms/Loader'
import { DDO, MetaDataMain } from '@oceanprotocol/squid'
import {
useOcean,
OceanConnectionStatus,
useSearch
} from '@oceanprotocol/react'
import Table from '../atoms/Table'
import Time from '../atoms/Time'
import Link from 'next/link'
import Price from '../atoms/Price'
import { fromWei } from 'web3-utils'
import { findServiceByType } from '../../utils'
import DateCell from '../atoms/Table/DateCell'
import DdoLinkCell from '../atoms/Table/DdoLinkCell'
const publishedColumns = [
{
name: 'Published',
selector: 'published',
sortable: true,
cell: function getCell(row: any) {
return <DateCell date={row.published} />
}
},
{
name: 'Name',
selector: 'name',
sortable: true,
cell: function getCell(row: any) {
return <DdoLinkCell id={row.id} name={row.name} />
}
},
{
name: 'Price',
selector: 'price',
sortable: true,
cell: function getCell(row: any) {
return <Price price={fromWei(row.price)} small />
}
}
]
export default function PublishedList() {
const { ocean, status, account, accountId } = useOcean()
const { getPublishedList } = useSearch()
const [publishedList, setPublishedList] = useState<any[]>([])
const [isLoading, setIsLoading] = useState(false)
const [paginationParams, setPaginationParams] = useState({
count: 1,
rowsPerPage: 10,
page: 1
})
useEffect(() => {
async function getPublished() {
if (
!account ||
!accountId ||
!ocean ||
status !== OceanConnectionStatus.CONNECTED
)
return
setIsLoading(true)
const publishedItems = await getPublishedList(
paginationParams.page,
paginationParams.rowsPerPage
)
setPaginationParams({
...paginationParams,
count: publishedItems.totalPages
})
const data = publishedItems.results.map(ddo => {
const { attributes } = findServiceByType(ddo, 'metadata')
const { name, price, datePublished } = attributes.main as MetaDataMain
return {
published: datePublished,
name: name,
price: price,
id: ddo.id
}
})
setPublishedList(data)
setIsLoading(false)
}
getPublished()
}, [accountId, ocean, status])
return isLoading ? (
<Loader />
) : account && ocean ? (
<Table data={publishedList} columns={publishedColumns} />
) : (
<div>Connect your wallet to see your published data sets.</div>
)
}

View File

@ -0,0 +1,17 @@
.grid {
display: grid;
gap: calc(var(--spacer) * 1.5);
position: relative;
}
@media (min-width: 55rem) {
.grid {
/* lazy golden ratio */
grid-template-columns: 1.618fr 1fr;
}
.sticky {
position: sticky;
top: var(--spacer);
}
}

View File

@ -0,0 +1,57 @@
import React from 'react'
import Layout from '../../Layout'
import styles from './Transactions.module.css'
import Web3Feedback from '../molecules/Web3Feedback'
import ConsumedList from '../organisms/ConsumedList'
import PublishedList from '../organisms/PublishedList'
import JobsList from '../organisms/JobsList'
const title = 'Transactions'
const description = 'Find the data sets and jobs that you previously accessed'
const sections = [
{
title: 'Published',
component: <PublishedList />
},
{
title: 'Downloaded',
component: <ConsumedList />
},
{
title: 'Compute Jobs',
component: <JobsList />
}
]
const Section = ({ title, component }: { title: string; component: any }) => {
return (
<div className={styles.section}>
<h2 className={styles.sectionTitle}>{title}</h2>
{component}
</div>
)
}
const TransactionsPage: React.FC = () => {
return (
<Layout title={title} description={description}>
<article className={styles.grid}>
<div>
{sections.map(section => {
const { title, component } = section
return <Section key={title} title={title} component={component} />
})}
</div>
<aside>
<div className={styles.sticky}>
<Web3Feedback />
</div>
</aside>
</article>
</Layout>
)
}
export default TransactionsPage

View File

@ -1,6 +1,6 @@
import React from 'react'
import { DDO } from '@oceanprotocol/squid'
import { MetaDataDexFreight } from '../../../@types/MetaData'
import { MetaDataMarket } from '../../../@types/MetaData'
import Time from '../../atoms/Time'
import MetaItem from './MetaItem'
import styles from './MetaFull.module.css'
@ -10,12 +10,12 @@ export default function MetaFull({
attributes
}: {
ddo: DDO | undefined
attributes: MetaDataDexFreight
attributes: MetaDataMarket
}) {
const { dateCreated, author, license } = attributes.main
let dateRange, granularity
let dateRange
if (attributes && attributes.additionalInformation) {
;({ dateRange, granularity } = attributes.additionalInformation)
;({ dateRange } = attributes.additionalInformation)
}
// In practice dateRange will always be defined, but in the rare case it isn't
@ -43,10 +43,6 @@ export default function MetaFull({
}
/>
{granularity && (
<MetaItem title="Data Granularity" content={granularity} />
)}
<MetaItem title="DID" content={<code>{ddo?.id}</code>} />
</div>
)

View File

@ -1,6 +1,6 @@
import React from 'react'
import shortid from 'shortid'
import { MetaDataDexFreight } from '../../../@types/MetaData'
import { MetaDataMarket } from '../../../@types/MetaData'
import { ListItem } from '../../atoms/Lists'
import { refundPolicy, assetTerms } from '../../../../site.config'
import MetaItem from './MetaItem'
@ -9,7 +9,7 @@ import styles from './MetaSecondary.module.css'
export default function MetaSecondary({
attributes
}: {
attributes: MetaDataDexFreight
attributes: MetaDataMarket
}) {
const { price } = attributes.main
let links, supportName, supportEmail

View File

@ -40,3 +40,7 @@
height: 100%;
min-height: 70vh;
}
.buttonGroup {
margin-top: var(--spacer);
margin-bottom: var(--spacer);
}

View File

@ -2,7 +2,7 @@ import React, { useEffect, useState } from 'react'
import { DDO, Aquarius, Logger, Curation } from '@oceanprotocol/squid'
import Link from 'next/link'
import Layout from '../../../Layout'
import { MetaDataDexFreight } from '../../../@types/MetaData'
import { MetaDataMarket } from '../../../@types/MetaData'
import Time from '../../atoms/Time'
import Markdown from '../../atoms/Markdown'
import Consume from '../../organisms/Consume'
@ -13,14 +13,14 @@ import MetaSecondary from './MetaSecondary'
import Rating from '../../atoms/Rating'
import RatingAction from './RatingAction'
import styles from './index.module.css'
import { config } from '../../../config/ocean'
import { findServiceByType } from '../../../utils'
import { useMetadata, useWeb3 } from '@oceanprotocol/react'
import { useMetadata, useOcean } from '@oceanprotocol/react'
import Compute from '../../organisms/Compute'
import DeleteAction from '../../molecules/DeleteAsset'
export declare type AssetDetailsPageProps = {
title: string
ddo?: DDO
attributes?: MetaDataDexFreight
attributes?: MetaDataMarket
error?: string
}
@ -28,11 +28,12 @@ const AssetDetailsPageMeta = ({
attributes,
ddo
}: {
attributes: MetaDataDexFreight
attributes: MetaDataMarket
ddo: DDO
}) => {
if (!attributes) return null
const { ocean, balanceInOcean } = useOcean()
const { datePublished } = attributes.main
const {
description,
@ -80,10 +81,24 @@ const AssetDetailsPageMeta = ({
{tags && tags.length > 0 && <Tags items={tags} />}
<MetaFull ddo={ddo} attributes={attributes} />
<div className={styles.buttonGroup}>
{/* <EditAction
ddo={ddo}
ocean={ocean}
account={account}
refetchMetadata={refetchMetadata}
/> */}
<DeleteAction ddo={ddo} />
</div>
</div>
<div>
<div className={styles.sticky}>
<Consume ddo={ddo} />
{isCompute ? (
<Compute ddo={ddo} ocean={ocean} balance={balanceInOcean} />
) : (
<Consume ddo={ddo} />
)}
<RatingAction did={ddo.id} onVote={onVoteUpdate} />
<MetaSecondary attributes={attributes} />
</div>

View File

@ -4,35 +4,27 @@ import Layout from '../../Layout'
import PageHeader from '../molecules/PageHeader'
import SearchBar from '../molecules/SearchBar'
import AssetList from '../organisms/AssetList'
import SearchCategoriesFilter from '../molecules/SearchCategoriesFilter'
import { SearchPriceFilter } from '../molecules/SearchPriceFilter'
import styles from './Search.module.css'
export declare type SearchPageProps = {
text: string | string[]
categories: string[] | undefined
tag: string | string[]
queryResult: QueryResult
}
const SearchPage = ({
text,
categories,
tag,
queryResult
}: SearchPageProps) => {
const categoriesText = categories?.join(', ')
const SearchPage = ({ text, tag, queryResult }: SearchPageProps) => {
return (
<Layout noPageHeader>
<section className={styles.grid}>
<div className={styles.search}>
<PageHeader title={`Search for ${text || categoriesText || tag}`} />
<PageHeader title={`Search for ${text || tag}`} />
{text && <SearchBar initialValue={text as string} />}
</div>
<aside className={styles.side}>
<SearchCategoriesFilter />
<SearchPriceFilter />
</aside>

View File

@ -15,20 +15,33 @@ export interface OceanConfig extends Config {
ratingUri: string
}
export const config: Partial<OceanConfig> = {
nodeUri: process.env.NODE_URI || 'https://pacific.oceanprotocol.com',
aquariusUri:
process.env.AQUARIUS_URI ||
'https://aquarius.pacific.dexfreight.dev-ocean.com',
brizoUri:
process.env.BRIZO_URI || 'https://brizo.pacific.dexfreight.dev-ocean.com',
brizoAddress:
process.env.BRIZO_ADDRESS || '0xeD792C5FcC8bF3322a6ba89A6e51eF0B6fB3C530',
secretStoreUri:
process.env.SECRET_STORE_URI || 'https://secret-store.oceanprotocol.com',
faucetUri: process.env.FAUCET_URI || 'https://faucet.oceanprotocol.com',
ratingUri:
process.env.RATING_URI || 'https://rating.pacific.dexfreight.dev-ocean.com',
// why is this partial?
// export const config: Partial<OceanConfig> = {
// nodeUri: process.env.NODE_URI || 'https://pacific.oceanprotocol.com',
// aquariusUri:
// process.env.AQUARIUS_URI ||
// 'https://aquarius.marketplace.oceanprotocol.com',
// brizoUri:
// process.env.BRIZO_URI || 'https://brizo.marketplace.oceanprotocol.com',
// brizoAddress:
// process.env.BRIZO_ADDRESS || '0x00c6A0BC5cD0078d6Cd0b659E8061B404cfa5704',
// secretStoreUri:
// process.env.SECRET_STORE_URI || 'https://secret-store.oceanprotocol.com',
// faucetUri: process.env.FAUCET_URI || 'https://faucet.oceanprotocol.com',
// ratingUri:
// process.env.RATING_URI || 'https://rating.pacific.marketplace.dev-ocean.com',
// verbose: 3
// }
// why is this partial?
export const config: OceanConfig = {
nodeUri: 'https://pacific.oceanprotocol.com',
aquariusUri: 'https://aquarius.marketplace.oceanprotocol.com',
brizoUri: 'https://brizo.marketplace.oceanprotocol.com',
brizoAddress: '0x00c6A0BC5cD0078d6Cd0b659E8061B404cfa5704',
secretStoreUri: 'https://secret-store.oceanprotocol.com',
faucetUri: 'https://faucet.oceanprotocol.com',
ratingUri: 'https://rating.pacific.marketplace.dev-ocean.com',
verbose: 3
}

1
src/images/eye.svg Normal file
View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-eye"><path d="M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"></path><circle cx="12" cy="12" r="3"></circle></svg>

After

Width:  |  Height:  |  Size: 316 B

View File

@ -1,6 +1,6 @@
import { MetaDataDexFreight } from '../@types/MetaData'
import { MetaDataMarket } from '../@types/MetaData'
const AssetModel: MetaDataDexFreight = {
const AssetModel: MetaDataMarket = {
// OEP-8 Attributes
// https://github.com/oceanprotocol/OEPs/tree/master/8
main: {
@ -15,7 +15,6 @@ const AssetModel: MetaDataDexFreight = {
additionalInformation: {
description: '',
copyrightHolder: '',
categories: [''],
tags: undefined,
// links: [],
@ -23,7 +22,6 @@ const AssetModel: MetaDataDexFreight = {
deliveryType: 'files',
termsAndConditions: false,
dateRange: undefined,
granularity: undefined,
supportName: undefined,
supportEmail: undefined,
access: 'Download'

View File

@ -3,7 +3,7 @@ import { JSONSchema6 } from 'json-schema'
import TermsWidget from '../components/atoms/FormWidgets/TermsWidget'
import DateRangeWidget from '../components/atoms/FormWidgets/DateRangeWidget'
import { ObjectFieldTemplate } from '../components/molecules/Form/ObjectFieldTemplate'
import { Granularity } from '../@types/MetaData'
import { Granularity, AccessType } from '../@types/MetaData'
import FileField from '../components/molecules/Form/FileField'
export const customWidgets = {
@ -11,26 +11,17 @@ export const customWidgets = {
DateRangeWidget
}
// Ref: https://react-jsonschema-form.readthedocs.io/en/latest/form-customization/#the-uischema-object
export const CATEGORIES = [
'Invoices',
'Historical location-based data',
'Shipment attribute (without rate information)',
'Shipment attribute (with rate information)',
'Other'
]
export const PublishFormSchema: JSONSchema6 = {
type: 'object',
required: [
'category',
'title',
'author',
'license',
'price',
'files',
'granularity',
'summary',
'termsAndConditions'
'termsAndConditions',
'access'
],
definitions: {
files: {
@ -43,11 +34,6 @@ export const PublishFormSchema: JSONSchema6 = {
}
},
properties: {
category: {
type: 'string',
title: 'What type of data will you be providing?',
enum: CATEGORIES
},
title: {
type: 'string',
title: 'Offer Title'
@ -71,22 +57,15 @@ export const PublishFormSchema: JSONSchema6 = {
type: 'number',
minimum: 0
},
granularity: {
type: 'string',
title: 'Granularity of Data',
enum: [
'Not updated periodically',
'Hourly',
'Daily',
'Weekly',
'Monthly',
'Annually'
]
},
author: {
type: 'string',
title: 'Author'
},
access: {
title: 'Access type',
type: 'string',
enum: ['Download', 'Compute']
},
license: {
title: 'License',
type: 'string',
@ -161,9 +140,9 @@ export const PublishFormUiSchema: UiSchema = {
price: {
'ui:help': 'Set your price in Ocean Tokens.'
},
granularity: {
access: {
'ui:widget': 'select',
'ui:help': 'Select the timeframe your data was collected.'
'ui:help': 'Access Type'
},
author: {
'ui:placeholder': 'e.g. Jelly McJellyfish',
@ -190,8 +169,6 @@ export const PublishFormUiSchema: UiSchema = {
export interface PublishFormDataInterface {
// ---- required fields ----
category: string
granularity: Granularity
summary: string
termsAndConditions: boolean
author: string
@ -199,6 +176,7 @@ export interface PublishFormDataInterface {
files: string[]
price: number
title: string
access?: AccessType
// ---- optional fields ----
dateRange?: string
holder?: string
@ -213,8 +191,6 @@ export const publishFormData: PublishFormDataInterface = {
title: '',
files: [''], // should be empty string initially to display the expanded field
summary: '',
category: '',
granularity: '',
license: '',
termsAndConditions: false,
dateRange: undefined,

View File

@ -8,13 +8,16 @@ import { title, description, url } from '../../site.config'
import { toast } from 'react-toastify'
// this is the place to import global css
import 'tippy.js/dist/tippy.css'
import 'react-responsive-modal/styles.css'
import '@oceanprotocol/typographies/css/ocean-typo.css'
import 'react-toastify/dist/ReactToastify.css'
import '../styles/global.css'
import '../components/atoms/NProgress.css'
import { Web3Provider, OceanProvider } from '@oceanprotocol/react'
import { Web3Provider, OceanProvider, Config } from '@oceanprotocol/react'
import { config } from '../config/ocean'
export default function dexfreightApp({ Component, pageProps }: AppProps) {
export default function marketApp({ Component, pageProps }: AppProps) {
const { asPath } = useRouter()
toast.configure()
@ -26,24 +29,6 @@ export default function dexfreightApp({ Component, pageProps }: AppProps) {
require('../styles/datepicker.css')
}
const config = {
nodeUri: process.env.NODE_URI || 'https://pacific.oceanprotocol.com',
aquariusUri:
process.env.AQUARIUS_URI ||
'https://aquarius.pacific.dexfreight.dev-ocean.com',
brizoUri:
process.env.BRIZO_URI || 'https://brizo.pacific.dexfreight.dev-ocean.com',
brizoAddress:
process.env.BRIZO_ADDRESS || '0xeD792C5FcC8bF3322a6ba89A6e51eF0B6fB3C530',
secretStoreUri:
process.env.SECRET_STORE_URI || 'https://secret-store.oceanprotocol.com',
faucetUri: process.env.FAUCET_URI || 'https://faucet.oceanprotocol.com',
ratingUri:
process.env.RATING_URI ||
'https://rating.pacific.dexfreight.dev-ocean.com',
verbose: 3
}
return (
<>
<Head>
@ -72,7 +57,7 @@ export default function dexfreightApp({ Component, pageProps }: AppProps) {
/>
<NProgress />
<Web3Provider>
<OceanProvider config={config}>
<OceanProvider config={config as Config}>
<Component {...pageProps} />
</OceanProvider>
</Web3Provider>

View File

@ -0,0 +1,31 @@
import { NextApiRequest, NextApiResponse } from 'next'
import axios, { AxiosResponse } from 'axios'
import siteConfig from '../../../site.config'
async function redeploy(
req: NextApiRequest
): Promise<AxiosResponse | undefined | string> {
// Cancel if we are not on live
if (req.headers.host !== siteConfig.url) return ''
console.log('not canceled', req)
try {
// Trigger new `master` deployment with Deploy Hook
const newDeployment = await axios.post(
'https://api.zeit.co/v1/integrations/deploy/Qmd5YCS9PCCCqn4mjgVR3vGkYWNmEB5UnAzhnjZiGbMCKa/Q6viwRoT4V'
)
return newDeployment
} catch (error) {
console.error(error.message)
}
}
export default async (req: NextApiRequest, res: NextApiResponse) => {
switch (req.method) {
case 'POST':
res.status(200).json(await redeploy(req))
break
default:
res.setHeader('Allow', ['POST'])
res.status(405).end(`Method ${req.method} Not Allowed`)
}
}

View File

@ -44,13 +44,29 @@ const AssetDetails: NextPage<AssetDetailsPageProps> = (
/>
)
}
export function normalizeDid(did: string): string {
if (did.length === 73) {
if (did.charAt(9) === '0' && did.charAt(10) === '0') {
return did.substr(0, 9) + did.substr(11)
}
}
return did
}
export async function getMetadata(did?: string) {
if (!did || !isDid(did)) {
if (did) {
did = normalizeDid(did)
if (!isDid(did)) {
return {
title: 'Not a DID',
error:
'The provided DID in the URL is not a valid DID. Please check your URL.'
}
}
} else {
return {
title: 'Not a DID',
error:
'The provided DID in the URL is not a valid DID. Please check your URL.'
title: 'No DID provided',
error: 'No DID provided. Please check your URL.'
}
}

View File

@ -18,7 +18,6 @@ export const getServerSideProps: GetServerSideProps = async context => {
created: -1
}
} as SearchQuery
const aquarius = new Aquarius(config.aquariusUri as string, Logger)
const queryResult = await aquarius.queryMetadata(searchQuery)
// Note: stringifying the results cause Next.js otherwise complains about

View File

@ -6,27 +6,14 @@ import SearchPage, { SearchPageProps } from '../components/templates/Search'
import { config } from '../config/ocean'
import { JSONparse, priceQueryParamToWei } from '../utils'
const Search: NextPage<SearchPageProps> = ({
text,
categories,
tag,
queryResult
}) => {
return (
<SearchPage
text={text}
categories={categories}
tag={tag}
queryResult={queryResult}
/>
)
const Search: NextPage<SearchPageProps> = ({ text, tag, queryResult }) => {
return <SearchPage text={text} tag={tag} queryResult={queryResult} />
}
export function getSearchQuery(
page?: string | string[],
offset?: string | string[],
text?: string | string[],
categoriesParsed?: string[],
tag?: string | string[],
priceQuery?: [string | undefined, string | undefined]
) {
@ -35,7 +22,6 @@ export function getSearchQuery(
offset: Number(offset) || 20,
query: {
text,
categories: categoriesParsed,
tags: tag ? [tag] : undefined,
price: priceQuery
},
@ -51,19 +37,8 @@ export function getSearchQuery(
}
Search.getInitialProps = async context => {
const {
text,
categories,
tag,
page,
offset,
minPrice,
maxPrice
} = context.query
const categoriesParsed = JSONparse<string[]>(
categories as string,
'Error parsing context.query.categories and setting categoriesParsed'
)
const { text, tag, page, offset, minPrice, maxPrice } = context.query
const minPriceParsed = priceQueryParamToWei(
minPrice as string,
'Error parsing context.query.minPrice'
@ -83,12 +58,11 @@ Search.getInitialProps = async context => {
const aquarius = new Aquarius(config.aquariusUri as string, Logger)
const queryResult = await aquarius.queryMetadata(
getSearchQuery(page, offset, text, categoriesParsed, tag, priceQuery)
getSearchQuery(page, offset, text, tag, priceQuery)
)
return {
text: text,
categories: categoriesParsed,
tag: tag,
queryResult
}

View File

@ -0,0 +1,9 @@
import { NextPage } from 'next'
import React from 'react'
import TransactionsPage from '../components/pages/Transactions'
const Transactions: NextPage = () => {
return <TransactionsPage />
}
export default Transactions

View File

@ -16,7 +16,7 @@ export default async function getFromFaucet(
url: `${config.faucetUri}/faucet`,
data: {
address: account,
agent: 'dexFreight'
agent: 'market'
}
})

View File

@ -149,3 +149,12 @@ export function formatBytes(a: number, b: number) {
const f = Math.floor(Math.log(a) / Math.log(c))
return parseFloat((a / Math.pow(c, f)).toFixed(d)) + ' ' + e[f]
}
export async function redeploy(): Promise<AxiosResponse | undefined> {
try {
const response = await axios.post('/api/redeploy')
return response
} catch (err) {
console.error(err.message)
}
}

View File

@ -1,9 +1,9 @@
import AssetModel from '../../src/models/Asset'
import { MetaDataDexFreight } from '../../src/@types/MetaData'
import { MetaDataMarket } from '../../src/@types/MetaData'
describe('AssetModel', () => {
it('values can be reassigned', () => {
const newMeta: MetaDataDexFreight = {
const newMeta: MetaDataMarket = {
main: Object.assign(AssetModel.main, {
name: 'Hello'
}),

View File

@ -1,5 +1,5 @@
import { DDO } from '@oceanprotocol/squid'
import { MetaDataDexFreight } from '../../../src/@types/MetaData'
import { MetaDataMarket } from '../../../src/@types/MetaData'
const ddo: Partial<DDO> = {
'@context': 'https://w3id.org/did/v1',
@ -37,22 +37,26 @@ const ddo: Partial<DDO> = {
{
index: 0,
contentType: 'csv',
contentLength: '114000'
contentLength: '114000',
url: ''
},
{
index: 1,
contentType: 'excel',
contentLength: '219000'
contentLength: '219000',
url: ''
},
{
index: 2,
contentType: 'csv',
contentLength: '1300000'
contentLength: '1300000',
url: ''
},
{
index: 3,
contentType: 'csv',
contentLength: '36300'
contentLength: '36300',
url: ''
}
]
},
@ -60,7 +64,6 @@ const ddo: Partial<DDO> = {
description:
'What a Waste is a global project to aggregate data on solid waste management from around the world. This database features the statistics collected through the effort, covering nearly all countries and over 330 cities. The metrics included cover all steps from the waste management value chain, including waste generation, composition, collection, and disposal, as well as information on user fees and financing, the informal sector, administrative structures, public communication, and legal information. The information presented is the best available based on a study of current literature and limited conversations with waste agencies and authorities. While there may be variations in the definitions and quality of reporting for individual data points, general trends should reflect the global reality. All sources and any estimations are noted.',
copyrightHolder: 'World Bank Group',
categories: ['Earth & Climate'],
tags: ['Sustainability', ' Climate', ' Energy', ' ai-for-good'],
links: [
{
@ -71,15 +74,15 @@ const ddo: Partial<DDO> = {
deliveryType: 'files',
termsAndConditions: true,
dateRange: ['2018-09-20T08:38:58', '2019-12-11T05:19:42'],
granularity: 'hourly',
supportName: 'Jelly McJellyfish',
supportEmail: 'jelly@oceanprotocol.com'
supportEmail: 'jelly@oceanprotocol.com',
access: 'Download'
},
curation: {
numVotes: 100,
rating: 5
}
} as MetaDataDexFreight,
} as MetaDataMarket,
index: 0
},
{

View File

@ -6,8 +6,6 @@ const testFormData: PublishFormDataInterface = {
license: '',
price: 0,
title: '',
granularity: 'hourly',
category: 'test',
summary: 'summary',
termsAndConditions: true
}

View File

@ -9,7 +9,7 @@ import {
} from '../../../src/models/PublishForm'
import testFormData from '../__fixtures__/testFormData'
import { transformPublishFormToMetadata } from '../../../src/components/molecules/PublishForm/PublishForm'
import { MetaDataDexFreight } from '../../../src/@types/MetaData'
import { MetaDataMarket } from '../../../src/@types/MetaData'
describe('PublishForm', () => {
it('renders without crashing', async () => {
@ -60,7 +60,7 @@ describe('PublishForm', () => {
it('Form data is correctly transformed to asset MetaData', () => {
const data: PublishFormDataInterface = publishFormData
let metadata: MetaDataDexFreight = transformPublishFormToMetadata(data)
let metadata: MetaDataMarket = transformPublishFormToMetadata(data)
expect(metadata.additionalInformation).toBeDefined()
expect(metadata.main).toBeDefined()

View File

@ -4,7 +4,7 @@ import AssetDetails, { getMetadata } from '../../../src/pages/asset/[did]'
import ddo from '../__fixtures__/ddo'
import { findServiceByType } from '../../../src/utils'
import web3ProviderMock, { context } from '../__mocks__/web3provider'
import { MetaDataDexFreight } from '../../../src/@types/MetaData'
import { MetaDataMarket } from '../../../src/@types/MetaData'
const { attributes } = findServiceByType(ddo, 'metadata')
@ -16,7 +16,7 @@ describe('AssetDetails', () => {
<context.Provider value={web3ProviderMock}>
<AssetDetails
ddo={JSON.stringify(ddo) as any}
attributes={attributes as MetaDataDexFreight}
attributes={attributes as MetaDataMarket}
title="Hello"
/>
</context.Provider>

View File

@ -15,12 +15,7 @@ describe('Search', () => {
totalResults: 200
}
const { container } = render(
<Search
text="Hello"
categories={['Hello']}
tag="Hello"
queryResult={queryResult}
/>
<Search text="Hello" tag="Hello" queryResult={queryResult} />
)
expect(container.firstChild).toBeInTheDocument()
@ -55,12 +50,7 @@ describe('Search', () => {
totalResults: 0
}
const { container } = render(
<Search
text="Hello"
categories={['Hello']}
tag="Hello"
queryResult={queryResult}
/>
<Search text="Hello" tag="Hello" queryResult={queryResult} />
)
expect(container.querySelector('.empty')).toBeInTheDocument()
})
@ -72,14 +62,12 @@ describe('Search.getInitialProps', () => {
context: Partial<NextPageContext>
) => {
text: string
categories: string[]
tag: string
queryResult: QueryResult
}
const context = {
query: {
text: 'text',
categories: '["category"]',
tag: 'tag',
page: '1',
offset: '1'
@ -87,7 +75,6 @@ describe('Search.getInitialProps', () => {
}
const props = await getInitialProps(context)
expect(props.text).toEqual('text')
expect(props.categories).toEqual(['category'])
expect(props.tag).toEqual('tag')
})
})

View File

@ -1,5 +1,5 @@
{
"name": "dexfreight",
"name": "market",
"build": {
"env": {
"NODE_URI": "@node_uri",