-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Partially updated token handling in order to soon start the Poo…
…ls and proper API handling.
- Loading branch information
Showing
28 changed files
with
796 additions
and
455 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// rawApiEndpoint.ts | ||
|
||
import { NextApiRequest, NextApiResponse } from "next"; | ||
import { AzureTokensToken } from "@/types/api/azure/tokens"; // Adjust the import path as necessary | ||
import { fetchAndTransform } from "@/utils/apis/fetchAndTransform"; | ||
|
||
export default async function handleRawApiRequest( | ||
_: NextApiRequest, | ||
res: NextApiResponse<AzureTokensToken[] | { error: string }> | ||
) { | ||
const apiUrl = "https://api-bridge-mainnet.azurewebsites.net/secret_tokens"; | ||
try { | ||
// Fetch data from the raw API endpoint | ||
const tokens = await fetchAndTransform<AzureTokensToken[]>(apiUrl); | ||
|
||
res.status(200).json(tokens); | ||
} catch (error: any) { | ||
res.status(500).json({ error: error.message || "Something went wrong" }); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// rawApiEndpoint.ts | ||
|
||
import { NextApiRequest, NextApiResponse } from "next"; | ||
import { | ||
AzureTokensResponse, | ||
AzureTokensToken, | ||
} from "@/types/api/azure/tokens"; | ||
import { fetchAndTransform } from "@/utils/apis/fetchAndTransform"; | ||
import { | ||
SecretToken, | ||
AzureSecretTokensResponse, | ||
} from "@/types/api/azure/secret_tokens"; | ||
|
||
export default async function handleRawApiRequest( | ||
_: NextApiRequest, | ||
res: NextApiResponse<(AzureTokensToken | SecretToken)[] | { error: string }> | ||
) { | ||
const apiUrl1 = "https://api-bridge-mainnet.azurewebsites.net/tokens"; | ||
|
||
const apiUrl2 = "https://bridge-bsc-mainnet.azurewebsites.net/tokens/"; | ||
const apiUrl3 = "https://api-bridge-mainnet.azurewebsites.net/secret_tokens/"; | ||
|
||
try { | ||
// Fetch data from the raw API endpoint | ||
// const tokens = await fetchAndTransform<AzureTokensToken[]>(apiUrl); | ||
const tokens1 = await fetchAndTransform<AzureTokensResponse>(apiUrl1); | ||
const tokens2 = await fetchAndTransform<AzureTokensResponse>(apiUrl2); | ||
const tokens3 = await fetchAndTransform<AzureSecretTokensResponse>(apiUrl3); | ||
|
||
// Combine the tokens from both sources | ||
const tokens = [...tokens1.tokens, ...tokens2.tokens, ...tokens3.tokens]; | ||
|
||
res.status(200).json(tokens); | ||
} catch (error: any) { | ||
res.status(500).json({ error: error.message || "Something went wrong" }); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.