add env var to access devnet

This commit is contained in:
Tyler Shipe 2021-04-25 12:22:28 -04:00
parent 2d489b29c4
commit 69e9ec1280
1 changed files with 8 additions and 3 deletions

View File

@ -30,7 +30,10 @@ export const ENDPOINTS: EndpointInfo[] = [
},
]
const CLUSTER = 'mainnet-beta'
type ClusterType = 'mainnet-beta' | 'devnet'
const CLUSTER =
(process.env.NEXT_PUBLIC_CLUSTER as ClusterType) || 'mainnet-beta'
const ENDPOINT = ENDPOINTS.find((e) => e.name === CLUSTER)
const DEFAULT_CONNECTION = new Connection(ENDPOINT.url, 'recent')
const WEBSOCKET_CONNECTION = new Connection(ENDPOINT.websocket, 'recent')
@ -63,7 +66,7 @@ interface MangoStore extends State {
}>
accountInfos: AccountInfoList
connection: {
cluster: string
cluster: ClusterType
current: Connection
websocket: Connection
endpoint: string
@ -114,7 +117,9 @@ interface MangoStore extends State {
}
tradeHistory: any[]
set: (x: any) => void
actions: any
actions: {
[key: string]: () => void
}
}
const useMangoStore = create<MangoStore>((set, get) => ({