Check Polymarket geo-restriction directly from the browser. * Must be called from client so Polymarket sees the user's real IP. * @see https://docs.polymarket.com/api-reference/geoblock
()
| 90 | * Must be called from client so Polymarket sees the user's real IP. |
| 91 | * @see https://docs.polymarket.com/api-reference/geoblock */ |
| 92 | async function checkGeoBlock(): Promise<{ blocked: boolean; country?: string }> { |
| 93 | try { |
| 94 | const res = await fetch("https://polymarket.com/api/geoblock", { |
| 95 | signal: AbortSignal.timeout(5_000), |
| 96 | }); |
| 97 | if (!res.ok) return { blocked: false }; |
| 98 | const data = await res.json(); |
| 99 | return { blocked: data?.blocked === true, country: data?.country }; |
| 100 | } catch { |
| 101 | return { blocked: false }; |
| 102 | } |
| 103 | } |
| 104 | |
| 105 | interface OrderFormProps { |
| 106 | tokenId: string; |