Backend https://bridge-lilac.vercel.app/
(issue: When using Vercel with a Hobby plan, serverless API routes can only be processed for 5 seconds.And xy finacne api service response in >5secs seconds, thus /quotes route responds with a 504 GATEWAY TIMEOUT error. thus it is recommended to test in local machine )
To get started with this project, clone the repository and follow the installation steps below.
git clone https://github.com/NitinPSingh/Bridge.git
cd Bridge
In new terminal Navigate to the /server directory:
cd Server
Install the required dependencies:
npm install
Start the backend server:
nodemon index.js
The backend server should now be running on http://localhost:3001
For testing Mocha ,Superset is used , run following command:
npm test
In new terminal Navigate to the /client directory:
cd client
Install the required dependencies:
npm install
change the local uri of backend
services/api.js
export const uri = "https://bridge-lilac.vercel.app" (comment)
// export const uri = "http://localhost:3001" (uncomment)
Start the frontend development server:
npm start
The frontend server should now be running on http://localhost:3000.
Description : Returns an array of supported tokens.
Example Request
GET /tokens
Example Response
{
"success": true,
"recommendedTokens": [
// Array of token objects
]
}
Description Returns a quote based on input parameters.
Request Json Body
{
"dstChainId": 1,
"dstQuoteTokenAddress": "0x6B175474E89094C44Da98b954EedeAC495271d0F",
"slippage": 0,
"srcChainId": 1,
"srcQuoteTokenAddress": "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",
"srcQuoteTokenAmount": "1000000000000000000"
}
Example Request
POST /quotes HTTP/1.1
Content-Type: application/json
{
"dstChainId": 1,
"dstQuoteTokenAddress": "0x6B175474E89094C44Da98b954EedeAC495271d0F",
"slippage": 0,
"srcChainId": 1,
"srcQuoteTokenAddress": "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",
"srcQuoteTokenAmount": "1000000000000000000"
}
Example Response
{
"success": true,
"routes": [
// Array of route objects
]
}