feat: preperations for open sourcing the repo (#771)
* feat: preperations for open sourcing the repo * fix: don’t use an apikey if there is none set
This commit is contained in:
parent
3c280518e8
commit
0acfe49815
14
.env.example
14
.env.example
@ -1,16 +1,16 @@
|
|||||||
|
## Mandatory Environment Variables
|
||||||
NEXT_PUBLIC_NETWORK=mainnet
|
NEXT_PUBLIC_NETWORK=mainnet
|
||||||
|
NEXT_PUBLIC_WALLET_CONNECT_ID=abcdefghijklmnopqrstuvwxyz
|
||||||
|
|
||||||
NEXT_PUBLIC_OSMOSIS_RPC=https://osmosis-node.marsprotocol.io/GGSFGSFGFG34/osmosis-rpc-front/
|
### Optional Environment Variables
|
||||||
NEXT_PUBLIC_OSMOSIS_REST=https://osmosis-node.marsprotocol.io/GGSFGSFGFG34/osmosis-lcd-front/
|
NEXT_PUBLIC_OSMOSIS_RPC=https://rpc-osmosis.blockapsis.com/
|
||||||
|
NEXT_PUBLIC_OSMOSIS_REST=https://lcd-osmosis.blockapsis.com/
|
||||||
NEXT_PUBLIC_OSMOSIS_TEST_RPC=https://rpc.devnet.osmosis.zone/
|
NEXT_PUBLIC_OSMOSIS_TEST_RPC=https://rpc.devnet.osmosis.zone/
|
||||||
NEXT_PUBLIC_OSMOSIS_TEST_REST=https://lcd.devnet.osmosis.zone/
|
NEXT_PUBLIC_OSMOSIS_TEST_REST=https://lcd.devnet.osmosis.zone/
|
||||||
NEXT_PUBLIC_NEUTRON_TEST_RPC=https://rpc-palvus.pion-1.ntrn.tech/
|
NEXT_PUBLIC_NEUTRON_TEST_RPC=https://rpc-palvus.pion-1.ntrn.tech/
|
||||||
NEXT_PUBLIC_NEUTRON_TEST_REST=https://rest-palvus.pion-1.ntrn.tech/
|
NEXT_PUBLIC_NEUTRON_TEST_REST=https://rest-palvus.pion-1.ntrn.tech/
|
||||||
|
|
||||||
NEXT_PUBLIC_WALLET_CONNECT_ID=d93fdffb159bae5ec87d8fee4cdbb045
|
### Enable the following environment variables if you have access to the charting library
|
||||||
CHARTING_LIBRARY_USERNAME=git_username
|
CHARTING_LIBRARY_USERNAME=git_username
|
||||||
CHARTING_LIBRARY_ACCESS_TOKEN=access_token
|
CHARTING_LIBRARY_ACCESS_TOKEN=access_token
|
||||||
CHARTING_LIBRARY_REPOSITORY=github.com/tradingview/charting_library/
|
CHARTING_LIBRARY_REPOSITORY=github.com/tradingview/charting_library/
|
||||||
|
|
||||||
NEXT_PUBLIC_PYTH_API=https://mars.rpc.p2p.world/api
|
|
||||||
NEXT_PUBLIC_API_KEY=api_key
|
|
@ -17,7 +17,7 @@ import { FC } from 'react'
|
|||||||
|
|
||||||
import chains from 'configs/chains'
|
import chains from 'configs/chains'
|
||||||
import { WALLETS } from 'constants/wallets'
|
import { WALLETS } from 'constants/wallets'
|
||||||
import { ChainInfoID, WalletID } from 'types/enums/wallet'
|
import { WalletID } from 'types/enums/wallet'
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
children?: React.ReactNode
|
children?: React.ReactNode
|
||||||
@ -37,23 +37,6 @@ function mapChainConfigToChainInfo(chainConfig: ChainConfig): ChainInfo {
|
|||||||
features: ['ibc-transfer', 'ibc-go'],
|
features: ['ibc-transfer', 'ibc-go'],
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (chainConfig.id) {
|
|
||||||
case ChainInfoID.Osmosis1:
|
|
||||||
chainInfo.rpc = process.env.NEXT_PUBLIC_OSMOSIS_RPC ?? chainInfo.rpc
|
|
||||||
chainInfo.rest = process.env.NEXT_PUBLIC_OSMOSIS_REST ?? chainInfo.rpc
|
|
||||||
break
|
|
||||||
|
|
||||||
case ChainInfoID.OsmosisDevnet:
|
|
||||||
chainInfo.rpc = process.env.NEXT_PUBLIC_OSMOSIS_TEST_RPC ?? chainInfo.rpc
|
|
||||||
chainInfo.rest = process.env.NEXT_PUBLIC_OSMOSIS_TEST_REST ?? chainInfo.rpc
|
|
||||||
break
|
|
||||||
|
|
||||||
case ChainInfoID.Pion1:
|
|
||||||
chainInfo.rpc = process.env.NEXT_PUBLIC_NEUTRON_TEST_RPC ?? chainInfo.rpc
|
|
||||||
chainInfo.rest = process.env.NEXT_PUBLIC_NEUTRON_TEST_REST ?? chainInfo.rpc
|
|
||||||
break
|
|
||||||
}
|
|
||||||
|
|
||||||
return chainInfo
|
return chainInfo
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,8 +33,8 @@ const Pion1: ChainConfig = {
|
|||||||
},
|
},
|
||||||
endpoints: {
|
endpoints: {
|
||||||
routes: 'https://app.astroport.fi/api/routes',
|
routes: 'https://app.astroport.fi/api/routes',
|
||||||
rest: 'https://rest-palvus.pion-1.ntrn.tech/',
|
rpc: process.env.NEXT_PUBLIC_NEUTRON_TEST_RPC ?? 'https://rpc-palvus.pion-1.ntrn.tech/',
|
||||||
rpc: 'https://rpc-palvus.pion-1.ntrn.tech/',
|
rest: process.env.NEXT_PUBLIC_NEUTRON_TEST_REST ?? 'https://rest-palvus.pion-1.ntrn.tech/',
|
||||||
swap: 'https://testnet-neutron.astroport.fi/swap',
|
swap: 'https://testnet-neutron.astroport.fi/swap',
|
||||||
pools: '', //TODO: ⛓️ Implement this
|
pools: '', //TODO: ⛓️ Implement this
|
||||||
explorer: 'https://testnet.mintscan.io/neutron-testnet',
|
explorer: 'https://testnet.mintscan.io/neutron-testnet',
|
||||||
|
@ -9,8 +9,8 @@ const Devnet: ChainConfig = {
|
|||||||
name: 'Osmosis Devnet',
|
name: 'Osmosis Devnet',
|
||||||
endpoints: {
|
endpoints: {
|
||||||
...Osmosis1.endpoints,
|
...Osmosis1.endpoints,
|
||||||
rpc: 'https://rpc.devnet.osmosis.zone/',
|
rpc: process.env.NEXT_PUBLIC_OSMOSIS_TEST_RPC ?? 'https://rpc-osmosis.blockapsis.com/',
|
||||||
rest: 'https://lcd.devnet.osmosis.zone/',
|
rest: process.env.NEXT_PUBLIC_OSMOSIS_TEST_REST ?? 'https://lcd-osmosis.blockapsis.com/',
|
||||||
swap: 'https://testnet.osmosis.zone',
|
swap: 'https://testnet.osmosis.zone',
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -137,8 +137,8 @@ const Osmosis1: ChainConfig = {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
endpoints: {
|
endpoints: {
|
||||||
rpc: 'https://osmosis-rpc.cosmos-apis.com?x-apikey=' + process.env.NEXT_PUBLIC_API_KEY,
|
rpc: process.env.NEXT_PUBLIC_OSMOSIS_RPC ?? 'https://rpc-osmosis.blockapsis.com/',
|
||||||
rest: 'https://osmosis-rest.cosmos-apis.com/',
|
rest: process.env.NEXT_PUBLIC_OSMOSIS_REST ?? 'https://lcd-osmosis.blockapsis.com/',
|
||||||
swap: 'https://app.osmosis.zone',
|
swap: 'https://app.osmosis.zone',
|
||||||
explorer: 'https://www.mintscan.io/osmosis/transactions/',
|
explorer: 'https://www.mintscan.io/osmosis/transactions/',
|
||||||
routes: 'https://sqs.osmosis.zone/router',
|
routes: 'https://sqs.osmosis.zone/router',
|
||||||
|
@ -19,7 +19,9 @@ async function getWalletBalances(chainConfig: ChainConfig, address: string): Pro
|
|||||||
const uri = '/cosmos/bank/v1beta1/balances/'
|
const uri = '/cosmos/bank/v1beta1/balances/'
|
||||||
|
|
||||||
const response = await fetch(
|
const response = await fetch(
|
||||||
`${chainConfig.endpoints.rest}${uri}${address}?x-apikey=${process.env.NEXT_PUBLIC_API_KEY}`,
|
process.env.NEXT_PUBLIC_API_KEY
|
||||||
|
? `${chainConfig.endpoints.rest}${uri}${address}?x-apikey=${process.env.NEXT_PUBLIC_API_KEY}`
|
||||||
|
: `${chainConfig.endpoints.rest}${uri}${address}`,
|
||||||
)
|
)
|
||||||
|
|
||||||
if (response.ok) {
|
if (response.ok) {
|
||||||
|
@ -1,16 +1,10 @@
|
|||||||
require('dotenv').config({ path: './.env.local' })
|
require('dotenv').config({ path: './.env.local' })
|
||||||
|
|
||||||
if (!process.env.CHARTING_LIBRARY_USERNAME) {
|
if (!process.env.NEXT_PUBLIC_NETWORK) {
|
||||||
throw 'CHARTING_LIBRARY_USERNAME is not defined'
|
throw 'NEXT_PUBLIC_NETWORK is not defined. Set ot to "mainnet" or "testnet".'
|
||||||
}
|
|
||||||
if (!process.env.CHARTING_LIBRARY_ACCESS_TOKEN) {
|
|
||||||
throw 'CHARTING_LIBRARY_ACCESS_TOKEN is not defined'
|
|
||||||
}
|
|
||||||
if (!process.env.CHARTING_LIBRARY_REPOSITORY) {
|
|
||||||
throw 'CHARTING_LIBRARY_REPOSITORY is not defined'
|
|
||||||
}
|
}
|
||||||
if (!process.env.NEXT_PUBLIC_WALLET_CONNECT_ID) {
|
if (!process.env.NEXT_PUBLIC_WALLET_CONNECT_ID) {
|
||||||
throw 'NEXT_PUBLIC_WALLET_CONNECT_ID is not defined'
|
throw 'NEXT_PUBLIC_WALLET_CONNECT_ID is not defined. Get a WalletConnect project ID from https://walletconnect.com/.'
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log('✅ Required env variables set')
|
console.log('✅ Required env variables set')
|
||||||
|
Loading…
Reference in New Issue
Block a user