Skip to content

Feat/degen mode#226

Merged
andriy-shymkiv merged 11 commits intomasterfrom
feat/degenMode
Mar 18, 2026
Merged

Feat/degen mode#226
andriy-shymkiv merged 11 commits intomasterfrom
feat/degenMode

Conversation

@andriy-shymkiv
Copy link
Contributor

@andriy-shymkiv andriy-shymkiv commented Mar 10, 2026

Accepts degenMode param for:

  • /transactions POST
  • /delta/orders POST
  • /prices GET
  • /delta/prices GET

Note

Medium Risk
Mostly additive optional query parameters, but it changes URL construction for getDeltaPrice and postDeltaOrder, which could break API calls if the path/query separator is incorrect.

Overview
Adds optional degenMode support across the SDK’s swap and Delta flows, threading it through rate queries (/prices), transaction building (/transactions), Delta price queries (/delta/prices), and Delta order submission (/delta/orders).

Also extends Delta price request/response typing (e.g., maxImpact, maxUSDImpact, and BUY-side src*BeforeFee fields in AvailableBridge) and adjusts URL construction for Delta price fetching and Delta order posting to incorporate query strings.

Written by Cursor Bugbot for commit 897a206. This will update automatically on new commits. Configure here.

@github-actions
Copy link

github-actions bot commented Mar 10, 2026

size-limit report 📦

Path Size
dist/sdk.cjs.production.min.js 16.38 KB (0%)
dist/sdk.esm.js 16.35 KB (0%)

@andriy-shymkiv andriy-shymkiv marked this pull request as ready for review March 10, 2026 18:23
@andriy-shymkiv andriy-shymkiv requested a review from Velenir March 10, 2026 18:24
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

const search = constructSearchString<{ degenMode?: boolean }>({
degenMode,
});
const fetchURL = `${postOrderUrl}/${search}` as const;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trailing slash changes POST URL for all orders

High Severity

The URL template `${postOrderUrl}/${search}` introduces a spurious / between the path and the query string. When degenMode is not provided (the common case), constructSearchString returns "", so the URL becomes …/delta/orders/ instead of the previous …/delta/orders. When degenMode is provided, it becomes …/delta/orders/?degenMode=true instead of …/delta/orders?degenMode=true. This is a regression for every postDeltaOrder call. The existing test expects the URL without a trailing slash. The sibling getDeltaOrders uses ${baseUrl}${search} (no extra /) for the same endpoint.

Fix in Cursor Fix in Web

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sometimes we do /search, sometimes without /. We should decide on one way

const search = constructSearchString<{ degenMode?: boolean }>({
degenMode,
});
const fetchURL = `${postOrderUrl}/${search}` as const;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sometimes we do /search, sometimes without /. We should decide on one way

/** @description SELL or BUY, default is SELL */
side?: SwapSideUnion;
/** @description In %. It's a way to bypass the API price impact check (default = 15%) */
maxImpact?: number;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you also add maxUSDImpact. It's present in other price endpoints

@andriy-shymkiv andriy-shymkiv merged commit eb1151d into master Mar 18, 2026
2 of 4 checks passed
@andriy-shymkiv andriy-shymkiv deleted the feat/degenMode branch March 18, 2026 15:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants