Merge pull request #15 from blockworks-foundation/max/ip-block2
Max/ip block2
This commit is contained in:
commit
b2348923e6
|
@ -36,10 +36,17 @@ export default function useIpAddress() {
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const checkIpLocation = async () => {
|
const checkIpLocation = async () => {
|
||||||
|
let ipCountryCode
|
||||||
|
try {
|
||||||
const response = await fetch(`https://www.cloudflare.com/cdn-cgi/trace`)
|
const response = await fetch(`https://www.cloudflare.com/cdn-cgi/trace`)
|
||||||
const parsedResponse = await response.text()
|
const parsedResponse = await response.text()
|
||||||
const ipLocation = parsedResponse.match(/loc=(.+)/)
|
const ipLocation = parsedResponse.match(/loc=(.+)/)
|
||||||
const ipCountryCode = ipLocation ? ipLocation[1] : ''
|
ipCountryCode = ipLocation ? ipLocation[1] : ''
|
||||||
|
} catch {
|
||||||
|
const response = await fetch(`https://countrycode.bonfida.workers.dev/`)
|
||||||
|
const parsedResponse = await response.json()
|
||||||
|
ipCountryCode = parsedResponse.countryCode
|
||||||
|
}
|
||||||
|
|
||||||
if (ipCountryCode) {
|
if (ipCountryCode) {
|
||||||
setIpAllowed(!SANCTIONED_COUNTRY_CODES.includes(ipCountryCode))
|
setIpAllowed(!SANCTIONED_COUNTRY_CODES.includes(ipCountryCode))
|
||||||
|
|
|
@ -26,8 +26,8 @@ import { calculateNativeAmountUnsafe } from '../utils/balance'
|
||||||
export const ENDPOINTS: EndpointInfo[] = [
|
export const ENDPOINTS: EndpointInfo[] = [
|
||||||
{
|
{
|
||||||
name: 'mainnet-beta',
|
name: 'mainnet-beta',
|
||||||
url: 'https://mango.rpcpool.com/',
|
url: 'https://cache-mango.rpcpool.com',
|
||||||
websocket: 'https://mango.rpcpool.com/',
|
websocket: 'https://cache-mango.rpcpool.com/cache',
|
||||||
programId: '6QXNNAPkPsWjd1j3qQJTvRFgSNPARMhF2tE8g1WeGyrM',
|
programId: '6QXNNAPkPsWjd1j3qQJTvRFgSNPARMhF2tE8g1WeGyrM',
|
||||||
poolKey: 'AHBj9LAjxStT2YQHN6QdfHKpZLtEVr8ACqeFgYcPsTnr',
|
poolKey: 'AHBj9LAjxStT2YQHN6QdfHKpZLtEVr8ACqeFgYcPsTnr',
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue