-
Notifications
You must be signed in to change notification settings - Fork 423
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
147 additions
and
36 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 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,32 @@ | ||
import { BridgeEnvironment, SkipApiClient } from "@osmosis-labs/bridge"; | ||
import { NextApiRequest, NextApiResponse } from "next"; | ||
|
||
/** This edge function is necessary to invoke the SkipApiClient on the server | ||
* as a secret API key is required for the client. | ||
*/ | ||
export default async function skipTrackTx( | ||
req: NextApiRequest, | ||
res: NextApiResponse | ||
) { | ||
const { chainID, txHash, env } = req.query as { | ||
chainID: string; | ||
txHash: string; | ||
env: BridgeEnvironment; | ||
}; | ||
|
||
if (!chainID || !txHash || !env) { | ||
return res.status(400).json({ error: "Missing required query parameters" }); | ||
} | ||
|
||
const skipClient = new SkipApiClient(env); | ||
|
||
try { | ||
const status = await skipClient.trackTransaction({ chainID, txHash }); | ||
return res.status(200).json(status); | ||
} catch (error) { | ||
if (error instanceof Error) { | ||
return res.status(500).json({ error: error.message }); | ||
} | ||
return res.status(500).json({ error: "An unknown error occurred" }); | ||
} | ||
} |
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,32 @@ | ||
import { BridgeEnvironment, SkipApiClient } from "@osmosis-labs/bridge"; | ||
import { NextApiRequest, NextApiResponse } from "next"; | ||
|
||
/** This edge function is necessary to invoke the SkipApiClient on the server | ||
* as a secret API key is required for the client. | ||
*/ | ||
export default async function skipTxStatus( | ||
req: NextApiRequest, | ||
res: NextApiResponse | ||
) { | ||
const { chainID, txHash, env } = req.query as { | ||
chainID: string; | ||
txHash: string; | ||
env: BridgeEnvironment; | ||
}; | ||
|
||
if (!chainID || !txHash || !env) { | ||
return res.status(400).json({ error: "Missing required query parameters" }); | ||
} | ||
|
||
const skipClient = new SkipApiClient(env); | ||
|
||
try { | ||
const status = await skipClient.transactionStatus({ chainID, txHash }); | ||
return res.status(200).json(status); | ||
} catch (error) { | ||
if (error instanceof Error) { | ||
return res.status(500).json({ error: error.message }); | ||
} | ||
return res.status(500).json({ error: "An unknown error occurred" }); | ||
} | ||
} |
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