feat: set default rpc endpoint (#485)

* feat: add default RPC endpoint

* feat: removed setting RPC endpoint altogherher and altered the routes accordingly
This commit is contained in:
Vojtech Simetka
2022-07-22 10:55:19 +02:00
committed by GitHub
parent 318592653c
commit cba21bb2e0
15 changed files with 179 additions and 259 deletions
+5 -4
View File
@@ -1,5 +1,6 @@
import { providers, Wallet } from 'ethers'
import { createContext, ReactElement, useEffect, useState } from 'react'
import config from '../config'
import { setJsonRpcInDesktop } from '../utils/desktop'
const LocalStorageKeys = {
@@ -10,18 +11,18 @@ const LocalStorageKeys = {
}
interface ContextInterface {
providerUrl: string | null
provider: providers.JsonRpcProvider | null
providerUrl: string
provider: providers.JsonRpcProvider
giftWallets: Wallet[]
setProviderUrl: (providerUrl: string) => void
addGiftWallet: (wallet: Wallet) => void
}
const providerUrl = localStorage.getItem('json-rpc-provider') || null
const providerUrl = localStorage.getItem('json-rpc-provider') || config.DEFAULT_RPC_URL
const initialValues: ContextInterface = {
providerUrl,
provider: providerUrl ? new providers.JsonRpcProvider(providerUrl) : null,
provider: new providers.JsonRpcProvider(providerUrl),
giftWallets: [],
setProviderUrl: () => {}, // eslint-disable-line
addGiftWallet: () => {}, // eslint-disable-line