Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

features alignment #402

Merged
merged 1 commit into from
Aug 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,15 @@

# Privacy Preference Center
#NEXT_PUBLIC_PRIVACY_PREFERENCE_CENTER="true"

# Development Preference Center
#NEXT_PUBLIC_NFT_FACTORY_ADDRESS='0xxx'
#NEXT_PUBLIC_OPF_COMMUNITY_FEE_COLECTOR='0xxx'
#NEXT_PUBLIC_FIXED_RATE_EXCHANGE_ADDRESS='0xxx'
#NEXT_PUBLIC_DISPENSER_ADDRESS='0xxx'
#NEXT_PUBLIC_OCEAN_TOKEN_ADDRESS='0xxx'
#NEXT_PUBLIC_MARKET_DEVELOPMENT='true'
#NEXT_PUBLIC_PROVIDER_URL="http://xxx:xxx"
#NEXT_PUBLIC_SUBGRAPH_URI="http://xxx:xxx"
#NEXT_PUBLIC_METADATACACHE_URI="http://xxx:xxx"
#NEXT_PUBLIC_RPC_URI="http://xxx:xxx"
18 changes: 6 additions & 12 deletions .jest/__fixtures__/datasetsWithAccessDetails.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,9 +157,9 @@ export const assets: AssetExtended[] = [
allocated: 45554.69921875,
orders: 1,
price: {
value: 3231343254,
tokenAddress: '0xCfDdA22C9837aE76E0faA845354f33C62E03653a',
tokenSymbol: 'OCEAN'
tokenAddress: '0x282d8efCe846A88B159800bd4130ad77443Fa1A1',
tokenSymbol: 'mOCEAN',
value: 100
}
},
version: '4.1.0',
Expand Down Expand Up @@ -1113,9 +1113,7 @@ export const assets: AssetExtended[] = [
allocated: 11159.279296875,
orders: 1,
price: {
value: 3231343254,
tokenAddress: '0xCfDdA22C9837aE76E0faA845354f33C62E03653a',
tokenSymbol: 'OCEAN'
value: 0
}
},
version: '4.1.0',
Expand Down Expand Up @@ -1198,9 +1196,7 @@ export const assets: AssetExtended[] = [
stats: {
orders: 0,
price: {
value: 3231343254,
tokenAddress: '0xCfDdA22C9837aE76E0faA845354f33C62E03653a',
tokenSymbol: 'OCEAN'
value: 0
}
},
version: '4.1.0',
Expand Down Expand Up @@ -1448,9 +1444,7 @@ export const assets: AssetExtended[] = [
stats: {
orders: 0,
price: {
value: 3231343254,
tokenAddress: '0xCfDdA22C9837aE76E0faA845354f33C62E03653a',
tokenSymbol: 'OCEAN'
value: 0
}
},
version: '4.1.0',
Expand Down
24 changes: 10 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,34 +65,30 @@ This will start the development server under

### Local components with Barge

If you prefer to connect to locally running components instead of remote connections, you can spin up [`barge`](https://github.com/oceanprotocol/barge) and use a local Ganache network in another terminal before running `npm start`:
Using the `ocean-market` with `barge` components is recommended for advanced users, if you are new we advice you to use the `ocean-market` first with remote networks. If you prefer to connect to locally running components instead of remote connections, you can spin up [`barge`](https://github.com/oceanprotocol/barge) and use a local Ganache network in another terminal before running `npm start`. To fully test all [The Graph](https://thegraph.com) integrations, you have to start barge with the local Graph node:

```bash
git clone [email protected]:oceanprotocol/barge.git
cd barge

# startup with local Ganache node
./start_ocean.sh
# startup with local Ganache and Graph nodes
./start_ocean.sh --with-thegraph
```

Barge will deploy contracts to the local Ganache node which will take some time. At the end the compiled artifacts need to be copied over to this project into `node_modules/@oceanprotocol/contracts/artifacts`. This script will do that for you:
Barge will deploy contracts to the local Ganache node which will take some time. At the end the compiled artifacts need to imported over to this project as environment variables. The `set-barge-env` script will do that for you and set the env variables to use this local connection in `.env` in the app. You also need to append the `chainIdsSupported` array with the barge's ganache chainId (`8996`) in the `app.config.js` file.

```bash
./scripts/copy-contracts.sh
```
If you are using `macOS` operating system you should also make same changes to the provider url since the default barge ip can not be accessed due to some network constraints on `macOs`. So we should be using the `127.0.0.1:8030` (if you have changed the provider port please use that here as well) for each direct call from the market to provider, but we should keep the internal barge url `http://172.15.0.4:8030/` (this is the default ip:port for provider in barge, if changed please use the according url). So on inside `src/@utils/provider.ts` if on `macOS` you can hardcode this env variable `NEXT_PUBLIC_PROVIDER_URL` or set
`127.0.0.1:8030` as `providerUrl` on all the methods that call `ProviderInstance` methods. (eg: `getEncryptedFiles`, `getFileDidInfo`, `downloadFile` etc). You should use the same provider url for `src/@utils/nft.ts` inside `setNFTMetadataAndTokenURI` and `setNftMetadata` and `src/components/Publish/index.tsx` inisde `encrypt` method (if you set the env variable there's no need to do this). You also need to use local ip's for the subgraph (`127.0.0.1` instead of `172.15.0.15`) and the metadatacache (`127.0.0.1` instead of `172.15.0.5`).

Finally, set environment variables to use this local connection in `.env` in the app:
Once you want to switch back to using the market agains remote networks you need to comment or remove the env vars that are set by `set-barge-env` script.

```bash
# modify env variables
cp .env.example .env

cd market
npm run set-barge-env
npm start
```

To use the app together with MetaMask, importing one of the accounts auto-generated by the Ganache container is the easiest way to have test ETH available. All of them have 100 ETH by default. Upon start, the `ocean_ganache_1` container will print out the private keys of multiple accounts in its logs. Pick one of them and import into MetaMask.

To fully test all [The Graph](https://thegraph.com) integrations, you have to run your own local Graph node with our [`ocean-subgraph`](https://github.com/oceanprotocol/ocean-subgraph) deployed to it. Barge does not include a local subgraph so by default, the `subgraphUri` is hardcoded to the Goerli subgraph in our [`getDevelopmentConfig` function](https://github.com/oceanprotocol/market/blob/d0b1534d105e5dcb3790c65d4bb04ff1d2dbc575/src/utils/ocean.ts#L31).
To use the app together with MetaMask, importing one of the accounts auto-generated by the Ganache container is the easiest way to have test ETH available. All of them have 100 ETH by default. Upon start, the `ocean_ganache_1` container will print out the private keys of multiple accounts in its logs. Pick one of them and import into MetaMask. Barge private key example : `0xc594c6e5def4bab63ac29eed19a134c130388f74f019bc74b8f4389df2837a58`

> Cleaning all Docker images so they are fetched freshly is often a good idea to make sure no issues are caused by old or stale images: `docker system prune --all --volumes`

Expand Down
4 changes: 4 additions & 0 deletions app.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ module.exports = {
// List of all supported chainIds. Used to populate the Chains user preferences list.
chainIdsSupported: [100, 80001],

customProviderUrl: process.env.NEXT_PUBLIC_PROVIDER_URL,

infuraProjectId: process.env.NEXT_PUBLIC_INFURA_PROJECT_ID || 'xxx',

defaultDatatokenTemplateIndex: 2,
// The ETH address the marketplace fee will be sent to.
marketFeeAddress:
Expand Down
68 changes: 29 additions & 39 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"build:static": "npm run build && next export",
"serve": "serve -s public/",
"pregenerate": "bash scripts/pregenerate.sh",
"set-barge-env": "bash scripts/barge-env.sh",
"test": "npm run pregenerate && npm run lint && npm run type-check && npm run jest",
"jest": "jest -c .jest/jest.config.js",
"jest:watch": "jest -c .jest/jest.config.js --watch",
Expand All @@ -30,7 +31,7 @@
"@coingecko/cryptoformat": "^0.5.4",
"@loadable/component": "^5.15.3",
"@oceanprotocol/art": "^3.2.0",
"@oceanprotocol/lib": "^3.0.2",
"@oceanprotocol/lib": "^3.0.4",
"@oceanprotocol/typographies": "^0.1.0",
"@oceanprotocol/use-dark-mode": "^2.4.3",
"@tippyjs/react": "^4.2.6",
Expand All @@ -44,7 +45,7 @@
"dom-confetti": "^0.2.2",
"ethers": "^5.7.2",
"filesize": "^10.0.7",
"formik": "^2.2.9",
"formik": "^2.4.2",
"gray-matter": "^4.0.3",
"is-ipfs": "^8.0.1",
"is-url-superb": "^6.1.0",
Expand Down Expand Up @@ -118,7 +119,7 @@
"process": "^0.11.10",
"serve": "^14.1.2",
"stream-http": "^3.2.0",
"tsconfig-paths-webpack-plugin": "^4.0.1",
"tsconfig-paths-webpack-plugin": "^4.1.0",
"typescript": "^4.9.3"
},
"overrides": {
Expand Down
2 changes: 2 additions & 0 deletions scripts/barge-env.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Set
node ./scripts/load-development-addresses.js
Loading
Loading