This file contains hidden or 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
| /** | |
| * Partna v4 webhook handler. Follows Partna's best practices: | |
| * 1. Verify the RSA-PSS signature before doing anything (reject spoofed events). | |
| * 2. Acknowledge with 200 immediately — a slow handler triggers redelivery. | |
| * 3. Process asynchronously and idempotently (a status change is applied at most once). | |
| * 4. Log the raw payload for troubleshooting. | |
| * See {@link verifyPartnaWebhookSignature} and {@link processPartnaWebhookEvent}. | |
| */ | |
| handlePartnaWebhook = async (req: Request<any, any, PartnaWebhookPayload>, res: Response) => { | |
| const payload = (req.body ?? {}) as PartnaWebhookPayload; |
This file contains hidden or 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
| { | |
| "success": true, | |
| "message": "Available assets fetched successfully", | |
| "data": { | |
| "allDexPerps": [ | |
| { | |
| "universe": [ | |
| { | |
| "szDecimals": 5, | |
| "name": "BTC", |
This file contains hidden or 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
| { | |
| "success": true, | |
| "message": "Available assets fetched successfully", | |
| "data": { | |
| "perps": [ | |
| { | |
| "symbol": "BTC", | |
| "type": "perp", | |
| "markPx": "72680.0", | |
| "maxLeverage": 40, |
This file contains hidden or 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
| let corpus = "the cat full overran the ran dog running do the needful"; | |
| corpus = corpus.replace(/ /g, "_"); | |
| let corpArr = corpus.split(""); | |
| const vocab = {}; | |
| const rules = []; | |
| let id = 1; | |
| const maxTokens = 50; | |
| const sep = "<sep>"; |