Detecting Restricted IPs
Due to compliance reasons, Swing is obligated to block the IPs of users connecting from the United States, Canada, or any OFAC-listed country.
You can learn more about Swing's compliance policy here
The consequence of Swing adhering to these compliance measures is that it can negatively impact the user experience for users residing in restricted regions, resulting in failed
transactions.
To enhance the user experience and make it more seamless, you can make a request to Swing's Cross-Chain API via the /v0/transfer/config/location
endpoint to check if a connecting user is situated in a restricted region.
Making a Request
GET: https://swap.prod.swing.xyz/v0/transfer/config/location
For the best user experience, we advise you to notify your users whether they're connecting from a restricted jurisdiction or not before letting them transact or interact with Swing.
Sample Request
If the endpoint returns an HTTP status code of 200
or OK
, then the result will contain a text response of the connecting user's IP address:
123.123.123.123
On the other hand, should the request fail, the endpoint will return a 403
or Forbidden
HTTP status code and a response body: