diff --git a/.env.barge b/.env.barge new file mode 100644 index 0000000000..f7ff605a65 --- /dev/null +++ b/.env.barge @@ -0,0 +1,29 @@ +NEXT_PUBLIC_METADATACACHE_URI="http://localhost:5000" +NEXT_PUBLIC_SUBGRAPH_URI="http://localhost:9000" +NEXT_RBAC_URL="http://localhost:3000" + +#NEXT_PUBLIC_INFURA_PROJECT_ID="xxx" +#NEXT_PUBLIC_MARKET_FEE_ADDRESS="0xxx" +#NEXT_PUBLIC_PUBLISHER_MARKET_ORDER_FEE="1" +#NEXT_PUBLIC_PUBLISHER_MARKET_POOL_SWAP_FEE="1" +#NEXT_PUBLIC_PUBLISHER_MARKET_FIXED_SWAP_FEE="1" +#NEXT_PUBLIC_CONSUME_MARKET_ORDER_FEE="1" +#NEXT_PUBLIC_CONSUME_MARKET_POOL_SWAP_FEE="1" +#NEXT_PUBLIC_CONSUME_MARKET_FIXED_SWAP_FEE="1" + + + +#NEXT_PUBLIC_PORTIS_ID="xxx" + + +# +# ADVANCED SETTINGS +# + +# Toggle pricing options presented during price creation +#NEXT_PUBLIC_ALLOW_FIXED_PRICING="true" +#NEXT_PUBLIC_ALLOW_DYNAMIC_PRICING="true" +#NEXT_PUBLIC_ALLOW_FREE_PRICING="true" + +# Privacy Preference Center +#NEXT_PUBLIC_PRIVACY_PREFERENCE_CENTER="true" diff --git a/app.config.js b/app.config.js index a8b4391293..705066fa7b 100644 --- a/app.config.js +++ b/app.config.js @@ -19,10 +19,10 @@ module.exports = { // List of chainIds which metadata cache queries will return by default. // This preselects the Chains user preferences. - chainIds: [1, 137, 56, 246, 1285], + chainIds: [1, 137, 56, 246, 1285, 8996], // List of all supported chainIds. Used to populate the Chains user preferences list. - chainIdsSupported: [1, 137, 56, 246, 1285, 3, 4, 80001, 1287], + chainIdsSupported: [1, 137, 56, 246, 1285, 3, 4, 80001, 1287, 8996], infuraProjectId: process.env.NEXT_PUBLIC_INFURA_PROJECT_ID || 'xxx', diff --git a/package.json b/package.json index 4c061bf941..429c8718ef 100644 --- a/package.json +++ b/package.json @@ -6,10 +6,12 @@ "homepage": "https://market.oceanprotocol.com", "scripts": { "start": "npm run pregenerate && next dev -p 8000", + "start-local": "npm run pregenerate-local && next dev -p 8000", "build": "npm run pregenerate && next build", "build:static": "npm run build && next export", "serve": "serve -s public/", "pregenerate": "bash scripts/pregenerate.sh", + "pregenerate-local": "bash scripts/pregenerate-local.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", @@ -19,6 +21,7 @@ "deploy:s3": "bash scripts/deploy-s3.sh", "postinstall": "husky install", "codegen:apollo": "apollo client:codegen --endpoint=https://v4.subgraph.ropsten.oceanprotocol.com/subgraphs/name/oceanprotocol/ocean-subgraph --target typescript --tsFileExtension=d.ts --outputFlat src/@types/subgraph/", + "codegen:apollo-local": "apollo client:codegen --endpoint=http://localhost:9000/subgraphs/name/oceanprotocol/ocean-subgraph --target typescript --tsFileExtension=d.ts --outputFlat src/@types/subgraph/", "storybook": "cross-env NODE_ENV=test start-storybook -p 6006 --quiet", "storybook:build": "cross-env NODE_ENV=test build-storybook" }, diff --git a/scripts/pregenerate-local.sh b/scripts/pregenerate-local.sh new file mode 100755 index 0000000000..22f105a8ca --- /dev/null +++ b/scripts/pregenerate-local.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env bash + +# Write out repo metadata +node ./scripts/write-repo-metadata > content/repo-metadata.json + +# Generate Apollo typings +npm run codegen:apollo-local + +# Fetch EVM networks metadata +node ./scripts/write-networks-metadata > content/networks-metadata.json diff --git a/scripts/write-networks-metadata.js b/scripts/write-networks-metadata.js index 37f951836a..6a404e10ad 100644 --- a/scripts/write-networks-metadata.js +++ b/scripts/write-networks-metadata.js @@ -7,5 +7,22 @@ const axios = require('axios') const chainDataUrl = 'https://chainid.network/chains.json' axios(chainDataUrl).then((response) => { + const development = { + name: 'Development', + chain: 'ETH', + icon: 'ethereum', + rpc: ['http://localhost:8545'], + faucets: [], + nativeCurrency: { + name: 'Ether', + symbol: 'ETH', + decimals: 18 + }, + shortName: 'eth', + chainId: 8996, + networkId: 8996, + slip44: 60 + } + response.data.push(development) process.stdout.write(JSON.stringify(response.data, null, ' ')) }) diff --git a/src/@utils/ocean.ts b/src/@utils/ocean.ts index e19cb25ce2..de6faafd81 100644 --- a/src/@utils/ocean.ts +++ b/src/@utils/ocean.ts @@ -1,10 +1,25 @@ import { ConfigHelper, LoggerInstance, Config } from '@oceanprotocol/lib' -// import contractAddresses from '@oceanprotocol/contracts/artifacts/address.json' +import contractAddresses from '@oceanprotocol/contracts/artifacts/address.json' import { AbiItem } from 'web3-utils/types' import Web3 from 'web3' +export function getDevelopmentConfig(): Config { + return { + oceanTokenAddress: contractAddresses.development?.Ocean, + erc721FactoryAddress: contractAddresses.development?.ERC721Factory, + poolTemplateAddress: contractAddresses.development?.poolTemplate, + fixedRateExchangeAddress: contractAddresses.development?.FixedPrice, + dispenserAddress: contractAddresses.development?.Dispenser, + sideStakingAddress: contractAddresses.development?.Staking, + // metadataContractAddress: contractAddresses.development?.Metadata, + subgraphUri: + process.env.NEXT_PUBLIC_SUBGRAPH_URI || + 'https://v4.subgraph.rinkeby.oceanprotocol.com' + } as unknown as Config +} + export function getOceanConfig(network: string | number): Config { - const config = new ConfigHelper().getConfig( + let config = new ConfigHelper().getConfig( network, network === 'polygon' || network === 'moonbeamalpha' || @@ -16,21 +31,12 @@ export function getOceanConfig(network: string | number): Config { ? undefined : process.env.NEXT_PUBLIC_INFURA_PROJECT_ID ) as Config + if (network === 8996) { + config = { ...config, ...getDevelopmentConfig() } + } return config as Config } -export function getDevelopmentConfig(): Config { - return { - // factoryAddress: contractAddresses.development?.DTFactory, - // poolFactoryAddress: contractAddresses.development?.BFactory, - // fixedRateExchangeAddress: contractAddresses.development?.FixedRateExchange, - // metadataContractAddress: contractAddresses.development?.Metadata, - // oceanTokenAddress: contractAddresses.development?.Ocean, - // There is no subgraph in barge so we hardcode the Rinkeby one for now - subgraphUri: 'https://v4.subgraph.rinkeby.oceanprotocol.com' - } as Config -} - export async function getOceanBalance( accountId: string, networkId: number,