-
Notifications
You must be signed in to change notification settings - Fork 35
feat(rest-api,sdk-router): intent endpoint [SYN-77] #3613
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
WalkthroughThe changes add a new API endpoint for retrieving intent quotes for token transfers. On the client side, a new type and methods (e.g., Changes
Sequence Diagram(s)sequenceDiagram
participant Client as Client Application
participant RC as REST Client (GetIntent)
participant HTTP as HTTP Transport
participant Parser as Response Parser
Client->>RC: Call GetIntent(ctx, params)
RC->>HTTP: Construct request with NewGetIntentRequest
HTTP-->>RC: Return HTTP response
RC->>Parser: Invoke ParseGetIntentResponse
Parser-->>RC: Return parsed GetIntentResponse
RC-->>Client: Deliver GetIntentResponse
sequenceDiagram
participant U as API User
participant ER as Express Router (/intent)
participant IC as IntentController
participant SDK as SynapseSDK.intent()
participant OPS as Intent Operations (_getSameChainIntentQuotes / _getCrossChainIntentQuotes)
U->>ER: GET /intent with query params
ER->>IC: Forward request to controller
IC->>SDK: Call intent method with validated parameters
SDK->>OPS: Determine same-chain or cross-chain flow
OPS-->>SDK: Return sorted intent quotes
SDK-->>IC: Return quotes to controller
IC-->>ER: Send JSON response with intent quotes
ER-->>U: HTTP response with intent quotes
Possibly related PRs
Poem
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #3613 +/- ##
===================================================
- Coverage 12.87099% 12.79437% -0.07663%
===================================================
Files 304 305 +1
Lines 33222 33546 +324
Branches 179 200 +21
===================================================
+ Hits 4276 4292 +16
- Misses 28461 28769 +308
Partials 485 485
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Deploying sanguine-fe with
|
Latest commit: |
02b8196
|
Status: | ✅ Deploy successful! |
Preview URL: | https://2432547d.sanguine-fe.pages.dev |
Branch Preview URL: | https://feat-intent-endpoint.sanguine-fe.pages.dev |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
🔭 Outside diff range comments (1)
packages/sdk-router/src/swap/engines/defaultPoolsEngine.ts (1)
107-107
: 🛠️ Refactor suggestionError log still references old engine name
The error log message still references "DefaultEngine" despite the class being renamed to "DefaultPoolsEngine".
- logger.error({ quote }, 'DefaultEngine: unexpected quote') + logger.error({ quote }, 'DefaultPoolsEngine: unexpected quote')
🧹 Nitpick comments (19)
packages/sdk-router/src/module/query.ts (1)
171-174
: Add JSDoc comments and implement test coverage.The new
isSwapQuery
function lacks JSDoc comments that would make it consistent with other functions in this file. Additionally, static analysis indicates that line 173 is not covered by unit tests.+/** + * Determines if the query is a swap query. + * + * @param query - The query to check. + * @returns True if the query is a swap query, false otherwise. + */ export const isSwapQuery = (query: Query): boolean => { const adapterAddress = query.swapAdapter ?? query.routerAdapter return adapterAddress !== AddressZero }🧰 Tools
🪛 GitHub Check: codecov/patch
[warning] 173-173: packages/sdk-router/src/module/query.ts#L173
Added line #L173 was not covered by testspackages/sdk-router/src/operations/swap.ts (3)
38-39
: Added new fields to SwapQuoteV2
IntroducingestimatedTime
andmoduleNames
allows the code to track multiple modules and approximate execution duration. Ensure clarity on whetherestimatedTime
represents seconds or another time unit.
73-75
: Return empty quote for unsupported chains
This gracefully short-circuits the logic for chains that don't support intents. Consider returning an explicit error or indicating the chain is unsupported if that’s more transparent to callers.
126-127
: Use chain-specific median block time
estimatedTime
is assigned fromMEDIAN_TIME_BLOCK[params.chainId]
. If partial-second values are expected, clarify or convert it into a more standard measure (e.g., rounding to an integer).packages/rest-api/src/controllers/intentController.ts (2)
16-37
: Parameter extraction from req.query
De-structuring query parameters is clear. Consider adding further type checks or fallback defaults for optional fields when necessary.
77-91
: Logging and error handling
Comprehensive logging ensures traceability. The 500 status code with a generic error message is standard practice, though consider returning a more descriptive error if feasible.contrib/restclient/client.gen.go (8)
273-301
: Add coverage for newly introduced parameters
GetIntentParams
is a new struct, yet the static analyzer reports no test coverage for these lines. Please consider creating or extending test cases (for example, verifying how optional fields likeAllowMultipleTxs
andSlippage
are handled).Would you like me to draft a sample test function asserting correct query parameter serialization?
760-770
: Consider status code checks
Currently, this client method returns the raw HTTP response without inspecting status codes. For better resiliency, you could check for 4xx/5xx codes and handle errors accordingly.🧰 Tools
🪛 GitHub Check: codecov/patch
[warning] 760-769: contrib/restclient/client.gen.go#L760-L769
Added lines #L760 - L769 were not covered by tests
3124-3125
: Clarify when multiple modules are used
Renaming from a singular tomoduleNames
indicates multi-module support. Please highlight this in your API docs or release notes so consumers know to expect arrays instead of single strings.
3676-3680
: Guard against nil HTTPResponse
AlthoughStatus()
delegates toHTTPResponse.Status
, adding a fallback for a nil response could prevent potential panics.🧰 Tools
🪛 GitHub Check: codecov/patch
[warning] 3676-3680: contrib/restclient/client.gen.go#L3676-L3680
Added lines #L3676 - L3680 were not covered by tests
3684-3688
: Default code fallback
Similar toStatus()
, consider returning a safe default (e.g.,0
) inStatusCode()
ifHTTPResponse
is nil, ensuring consistent behavior.🧰 Tools
🪛 GitHub Check: codecov/patch
[warning] 3684-3688: contrib/restclient/client.gen.go#L3684-L3688
Added lines #L3684 - L3688 were not covered by tests
4124-4125
: Reflect multiple modules in documentation
WithModuleNames
now treated as an array, confirm that the consumer docs and any clients can handle multiple module names gracefully.
4462-4467
: Check all response outcomes
GetIntentWithResponse
covers the happy path, but ensure 4xx/5xx results are also surfaced or handled. This can help callers avoid silent failures.🧰 Tools
🪛 GitHub Check: codecov/patch
[warning] 4462-4467: contrib/restclient/client.gen.go#L4462-L4467
Added lines #L4462 - L4467 were not covered by tests
5417-5539
: Add catch-all for unexpected statuses
ParseGetIntentResponse
does a good job of checking known statuses. For better maintainability, a catch-all or default branch can help detect unrecognized error codes more gracefully.🧰 Tools
🪛 GitHub Check: codecov/patch
[warning] 5417-5422: contrib/restclient/client.gen.go#L5417-L5422
Added lines #L5417 - L5422 were not covered by tests
[warning] 5424-5510: contrib/restclient/client.gen.go#L5424-L5510
Added lines #L5424 - L5510 were not covered by tests
[warning] 5512-5524: contrib/restclient/client.gen.go#L5512-L5524
Added lines #L5512 - L5524 were not covered by tests
[warning] 5526-5533: contrib/restclient/client.gen.go#L5526-L5533
Added lines #L5526 - L5533 were not covered by tests
[warning] 5537-5537: contrib/restclient/client.gen.go#L5537
Added line #L5537 was not covered by testspackages/sdk-router/src/operations/intent.ts (5)
5-10
: Consider centralizing import paths.Having multiple imports referencing various internal folders (
../module
,../sdk
,../swap
,./bridge
,./swap
,../utils
) is acceptable, but you may want to consider centralizing or organizing imports and exports in a dedicated index barrel file for improved readability and maintainability.
12-23
: Add validation checks on user inputs.
IntentParameters
includes optional fields likefromSender
,toRecipient
,slippage
,deadline
, andallowMultipleTxs
. If these fields are critical for certain workflow behaviors, consider adding internal validations (e.g., checking ifslippage
is a reasonable percentage, verifying thatdeadline
is in the future, etc.) to prevent invalid or malicious parameters.
25-36
: Provide clarity on expectedTime measurement.In
IntentQuote
, theestimatedTime
field is included but not fully documented. It would be helpful to indicate what this time measurement represents (e.g., seconds or milliseconds) to avoid confusion for consumers of this SDK.
47-87
: Add more robust handling for zero or undefined quotes.
_getSameChainIntentQuotes
currently returns an empty array ifswapQuote
is falsy orexpectedToAmount.isZero()
. This prevents generating invalid quotes, which is good. However, consider logging or counting how often these scenarios arise, especially if a zero-amount quote might indicate unexpected behavior in upstream logic (e.g., insufficient liquidity).
160-161
: Double-check aggregated time calculation.
estimatedTime: bridgeQuote.estimatedTime + swapQuote.estimatedTime
is a simple sum of two times. This is okay as a rough total. However, transit times may be non-linear or have overlap. Consider clarifying or refining the timing model if more accurate or separate time calculations are needed.
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (26)
contrib/restclient/client.gen.go
(12 hunks)packages/rest-api/src/controllers/intentController.ts
(1 hunks)packages/rest-api/src/routes/bridgeV2Route.ts
(2 hunks)packages/rest-api/src/routes/index.ts
(1 hunks)packages/rest-api/src/routes/intentRoute.ts
(1 hunks)packages/rest-api/src/routes/swapV2Route.ts
(2 hunks)packages/rest-api/swagger.json
(5 hunks)packages/sdk-router/src/constants/addresses.ts
(0 hunks)packages/sdk-router/src/constants/chainIds.ts
(1 hunks)packages/sdk-router/src/constants/medianTime.ts
(1 hunks)packages/sdk-router/src/module/query.ts
(1 hunks)packages/sdk-router/src/module/synapseModuleSet.ts
(3 hunks)packages/sdk-router/src/module/types.ts
(2 hunks)packages/sdk-router/src/operations/bridge.ts
(7 hunks)packages/sdk-router/src/operations/index.ts
(1 hunks)packages/sdk-router/src/operations/intent.ts
(1 hunks)packages/sdk-router/src/operations/swap.ts
(5 hunks)packages/sdk-router/src/rfq/fastBridgeRouterSet.ts
(4 hunks)packages/sdk-router/src/sdk.ts
(1 hunks)packages/sdk-router/src/sir/synapseIntentRouterSet.ts
(3 hunks)packages/sdk-router/src/swap/core/__tests__/engineID.test.ts
(1 hunks)packages/sdk-router/src/swap/core/engineID.ts
(1 hunks)packages/sdk-router/src/swap/engines/defaultPoolsEngine.ts
(3 hunks)packages/sdk-router/src/swap/engines/index.ts
(1 hunks)packages/sdk-router/src/swap/models/priority.ts
(1 hunks)packages/sdk-router/src/swap/swapEngineSet.ts
(2 hunks)
💤 Files with no reviewable changes (1)
- packages/sdk-router/src/constants/addresses.ts
🧰 Additional context used
🧬 Code Definitions (6)
packages/sdk-router/src/swap/core/__tests__/engineID.test.ts (1)
packages/sdk-router/src/swap/core/engineID.ts (1) (1)
validateEngineID
(10-12)
packages/sdk-router/src/constants/chainIds.ts (1)
packages/rest-api/src/constants/index.ts (1) (1)
INTENTS_SUPPORTED_CHAIN_IDS
(3-3)
packages/sdk-router/src/operations/swap.ts (2)
packages/sdk-router/src/constants/chainIds.ts (1) (1)
areIntentsSupported
(136-138)packages/sdk-router/src/constants/medianTime.ts (1) (1)
MEDIAN_TIME_BLOCK
(7-34)
packages/sdk-router/src/module/synapseModuleSet.ts (3)
packages/sdk-router/src/module/types.ts (2) (2)
BridgeTokenCandidate
(85-90)BridgeRouteV2
(92-99)packages/sdk-router/src/swap/core/slippage.ts (1) (1)
Slippage
(4-7)packages/sdk-router/src/operations/bridge.ts (1) (1)
bridgeQuote
(350-374)
packages/sdk-router/src/operations/bridge.ts (5)
packages/sdk-router/src/utils/types.ts (1) (1)
Prettify
(24-26)packages/sdk-router/src/sdk.ts (1) (1)
SynapseSDK
(101-101)packages/sdk-router/src/module/types.ts (1) (1)
BridgeQuoteV2
(115-129)packages/sdk-router/src/constants/chainIds.ts (2) (2)
isChainIdSupported
(130-134)areIntentsSupported
(136-138)packages/sdk-router/src/module/query.ts (1) (1)
isSwapQuery
(171-174)
packages/sdk-router/src/swap/swapEngineSet.ts (1)
packages/sdk-router/src/swap/engines/defaultPoolsEngine.ts (1) (1)
DefaultPoolsEngine
(22-112)
🪛 GitHub Check: codecov/patch
packages/sdk-router/src/module/query.ts
[warning] 173-173: packages/sdk-router/src/module/query.ts#L173
Added line #L173 was not covered by tests
packages/sdk-router/src/constants/chainIds.ts
[warning] 138-138: packages/sdk-router/src/constants/chainIds.ts#L138
Added line #L138 was not covered by tests
packages/sdk-router/src/operations/bridge.ts
[warning] 57-57: packages/sdk-router/src/operations/bridge.ts#L57
Added line #L57 was not covered by tests
[warning] 88-88: packages/sdk-router/src/operations/bridge.ts#L88
Added line #L88 was not covered by tests
contrib/restclient/client.gen.go
[warning] 760-769: contrib/restclient/client.gen.go#L760-L769
Added lines #L760 - L769 were not covered by tests
[warning] 1840-1846: contrib/restclient/client.gen.go#L1840-L1846
Added lines #L1840 - L1846 were not covered by tests
[warning] 1848-1851: contrib/restclient/client.gen.go#L1848-L1851
Added lines #L1848 - L1851 were not covered by tests
[warning] 1853-1856: contrib/restclient/client.gen.go#L1853-L1856
Added lines #L1853 - L1856 were not covered by tests
[warning] 1858-1869: contrib/restclient/client.gen.go#L1858-L1869
Added lines #L1858 - L1869 were not covered by tests
[warning] 1873-1881: contrib/restclient/client.gen.go#L1873-L1881
Added lines #L1873 - L1881 were not covered by tests
[warning] 1885-1893: contrib/restclient/client.gen.go#L1885-L1893
Added lines #L1885 - L1893 were not covered by tests
[warning] 1897-1907: contrib/restclient/client.gen.go#L1897-L1907
Added lines #L1897 - L1907 were not covered by tests
[warning] 1913-1921: contrib/restclient/client.gen.go#L1913-L1921
Added lines #L1913 - L1921 were not covered by tests
[warning] 1925-1933: contrib/restclient/client.gen.go#L1925-L1933
Added lines #L1925 - L1933 were not covered by tests
[warning] 1937-1947: contrib/restclient/client.gen.go#L1937-L1947
Added lines #L1937 - L1947 were not covered by tests
[warning] 1953-1963: contrib/restclient/client.gen.go#L1953-L1963
Added lines #L1953 - L1963 were not covered by tests
[warning] 1969-1979: contrib/restclient/client.gen.go#L1969-L1979
Added lines #L1969 - L1979 were not covered by tests
[warning] 1985-1985: contrib/restclient/client.gen.go#L1985
Added line #L1985 was not covered by tests
[warning] 1988-1991: contrib/restclient/client.gen.go#L1988-L1991
Added lines #L1988 - L1991 were not covered by tests
[warning] 1993-1993: contrib/restclient/client.gen.go#L1993
Added line #L1993 was not covered by tests
[warning] 3676-3680: contrib/restclient/client.gen.go#L3676-L3680
Added lines #L3676 - L3680 were not covered by tests
[warning] 3684-3688: contrib/restclient/client.gen.go#L3684-L3688
Added lines #L3684 - L3688 were not covered by tests
[warning] 4462-4467: contrib/restclient/client.gen.go#L4462-L4467
Added lines #L4462 - L4467 were not covered by tests
[warning] 4837-4838: contrib/restclient/client.gen.go#L4837-L4838
Added lines #L4837 - L4838 were not covered by tests
[warning] 5417-5422: contrib/restclient/client.gen.go#L5417-L5422
Added lines #L5417 - L5422 were not covered by tests
[warning] 5424-5510: contrib/restclient/client.gen.go#L5424-L5510
Added lines #L5424 - L5510 were not covered by tests
[warning] 5512-5524: contrib/restclient/client.gen.go#L5512-L5524
Added lines #L5512 - L5524 were not covered by tests
[warning] 5526-5533: contrib/restclient/client.gen.go#L5526-L5533
Added lines #L5526 - L5533 were not covered by tests
[warning] 5537-5537: contrib/restclient/client.gen.go#L5537
Added line #L5537 was not covered by tests
[warning] 6108-6109: contrib/restclient/client.gen.go#L6108-L6109
Added lines #L6108 - L6109 were not covered by tests
🪛 Gitleaks (8.21.2)
packages/rest-api/swagger.json
1642-1642: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
1645-1645: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
1652-1652: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
1655-1655: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: Cloudflare Pages
🔇 Additional comments (66)
packages/sdk-router/src/swap/models/priority.ts (1)
21-21
: Engine ID key updated in priority configurationThe engine priority configuration has been updated to use the renamed
EngineID.DefaultPools
key instead ofEngineID.Default
, while maintaining the same priority value. This ensures that the priority system continues to work correctly with the renamed engine.packages/sdk-router/src/swap/swapEngineSet.ts (2)
8-8
: Import statement correctly updated to reflect engine renameThe import statement has been appropriately updated to reference
DefaultPoolsEngine
which aligns with the class name changes in the codebase.
54-54
: Class instantiation updated to match renamed engineThe engine instantiation has been correctly updated to use
DefaultPoolsEngine
instead ofDefaultEngine
, maintaining consistency with the renamed class.packages/sdk-router/src/swap/engines/defaultPoolsEngine.ts (3)
22-22
: Class name updated from DefaultEngine to DefaultPoolsEngineThe class has been appropriately renamed to better reflect its purpose of working with pools.
25-25
: Engine ID updated to match new nameThe engine ID has been correctly updated from
EngineID.Default
toEngineID.DefaultPools
to maintain consistency with the class rename.
35-35
: References to static interface updatedReferences to the static
previewerInterface
have been properly updated to use the new class name.Also applies to: 52-53
packages/sdk-router/src/swap/core/engineID.ts (1)
4-4
:✅ Verification successful
Rename enum value for clarity
Renaming
Default
toDefaultPools
provides more descriptive naming that better indicates the purpose of this engine ID. This is a good improvement for code readability and maintainability.
🏁 Script executed:
#!/bin/bash # Verify that all references to the old enum value have been updated echo "Checking for any remaining references to EngineID.Default that might have been missed..." rg "EngineID\.Default" --type tsLength of output: 652
Enum Value Renaming Verified – No Remaining References to EngineID.Default
The renaming change from
Default
toDefaultPools
has been successfully propagated throughout the codebase. All occurrences now correctly referenceEngineID.DefaultPools
(as verified in the following files):
packages/sdk-router/src/swap/models/priority.ts
packages/sdk-router/src/swap/engines/defaultPoolsEngine.ts
packages/sdk-router/src/operations/bridge.ts
packages/sdk-router/src/swap/core/__tests__/engineID.test.ts
This improvement enhances code readability and maintainability.
packages/sdk-router/src/swap/core/__tests__/engineID.test.ts (1)
7-7
: Correctly updated test case for renamed enum valueThe test case has been properly updated to validate the renamed enum value
EngineID.DefaultPools
instead of the previous value. This change maintains test coverage while aligning with the enum update.packages/sdk-router/src/swap/engines/index.ts (1)
1-1
:✅ Verification successful
Updated export path for renamed module
The export path has been correctly updated to point to the renamed module
./defaultPoolsEngine
instead of the previous./defaultEngine
. This ensures consistent renaming throughout the codebase.
🏁 Script executed:
#!/bin/bash # Verify that the defaultPoolsEngine.ts file exists and defaultEngine.ts is either removed or renamed echo "Checking for the existence of the new and old engine files..." find packages/sdk-router/src/swap/engines -name "defaultPoolsEngine.ts" -o -name "defaultEngine.ts" # Check if there are any imports referring to the old file path echo "Checking for any imports still referring to the old file path..." rg "from ['\"]\.{1,2}/.*defaultEngine['\"]" --type tsLength of output: 488
Export Path Verification Complete
The updated export path now correctly references the renamed module alongside the confirmed existence of
packages/sdk-router/src/swap/engines/defaultPoolsEngine.ts
. No references to the old module (defaultEngine
) were detected in the TypeScript imports.
- Verified that
defaultPoolsEngine.ts
exists.- Confirmed that no file or import paths reference
defaultEngine
.packages/sdk-router/src/operations/index.ts (1)
2-2
: LGTM!This addition exports the new intent functionality, making it accessible as part of the public API.
packages/rest-api/src/routes/index.ts (1)
18-18
: LGTM!The import and route integration for the new intent endpoint follow the established pattern in the codebase.
Also applies to: 23-23
packages/sdk-router/src/constants/medianTime.ts (1)
3-34
: LGTM!The new constant is well-documented and provides comprehensive coverage of block production times across all supported chains, which will help in providing accurate time estimates for operations.
packages/sdk-router/src/sdk.ts (1)
66-66
: Addition of intent property looks good.The new property follows the existing pattern of exposing operations directly from the SDK class. This is consistent with other public properties like bridge, bridgeV2, etc.
packages/rest-api/src/routes/swapV2Route.ts (2)
89-93
: OpenAPI documentation updates look good.The change from
moduleName
(singular) tomoduleNames
(array of strings) in the documentation properly reflects that multiple swap modules can be used for a quote.
117-117
: Example value update is consistent with the property change.The example has been updated to show
moduleNames
as an array with a single value "DefaultPools", which aligns with the schema definition change.packages/sdk-router/src/constants/chainIds.ts (1)
130-134
: Utility function addition looks good.The
isChainIdSupported
function provides a useful type predicate to verify if a chainId is supported, checking both the inclusion in SupportedChainId enum and ensuring it's not in the paused list.packages/rest-api/src/routes/bridgeV2Route.ts (2)
111-115
: OpenAPI documentation updates for bridge endpoint look good.The change from
moduleName
tomoduleNames
as an array type is consistent with the updates in the swap endpoint documentation and improves the API by supporting multiple modules per quote.
144-144
: Example value update is consistent with the schema change.The example has been updated to show
moduleNames
as an array with a value of ["SynapseRFQ"], which properly aligns with the schema definition.packages/sdk-router/src/sir/synapseIntentRouterSet.ts (3)
57-57
: Initialize array for multiple modules
This adds support for collecting the names of multiple modules. Good improvement for multi-module bridging.
66-66
: Verify usage of engineName
If there’s any possibility thatoriginSwapRoute.engineName
is undefined, consider guarding this push operation. Otherwise, this approach is well-structured.
97-97
: Replacing moduleName with moduleNames
Switching to an array fosters extensibility for bridging or swapping across multiple modules. This aligns with the new approach across the codebase.packages/sdk-router/src/operations/swap.ts (2)
7-7
: Imports for chain support checks
ImportingareIntentsSupported
andMEDIAN_TIME_BLOCK
broadens functionality for chain-specific features.
63-64
: Initialize empty arrays in fallback
Using an empty array formoduleNames
and zero forestimatedTime
ensures consistent object shape for uninitialized quotes.packages/rest-api/src/controllers/intentController.ts (3)
1-9
: Initial imports
Imports forexpress-validator
,Synapse
, and logging are well-structured. The usage of constants and utility functions indicates a well-organized approach.
11-15
: Validation error handling
Returning a 400 witherrors.array()
is a clear pattern. Good approach to early-exit on invalid requests.
39-76
: Converting slippage to basis points & calling Synapse.intent
This logic is straightforward and reuses known constants (DEFAULT_SWAP_SLIPPAGE_BIPS
,SLIPPAGE_BIPS_DENOMINATOR
). All bigger request parameters are passed toSynapse.intent
. The BigNumber to string conversion and JSON response are well-handled.packages/rest-api/src/routes/intentRoute.ts (5)
1-4
: Importing express and express-validator
Essential for route definitions and request validation.
5-10
: Middleware and services
Includes the required middlewares likechecksumAddresses
andnormalizeNativeTokenAddress
, ensuring addresses are validated and normalized. This is a good practice for consistent address handling.
14-197
: OpenAPI documentation
Providing a comprehensive doc block describing the endpoint, parameters, and example responses ensures clarity for integrators.
238-296
: GET /intent route
The combined validation checks for chain IDs, token addresses, slippage, and optional fields. This thorough approach significantly reduces invalid calls. Great job integrating withshowFirstValidationError
.
298-299
: Named Export for router
Exporting as the default simplifies usage inindex.ts
. This is consistent with typical Express router design.packages/sdk-router/src/module/synapseModuleSet.ts (4)
19-32
: Documentation improvements and parameter update for getBridgeTokenCandidatesGood work adding JSDoc comments to clearly document the
GetBridgeTokenCandidatesParameters
type. MakingtoToken
optional is a sensible enhancement that allows for more flexible use cases where the destination token isn't known upfront.
34-54
: Comprehensive documentation and support for multi-transaction bridgesThe added JSDoc comments for
GetBridgeRouteV2Parameters
are clear and informative. The newallowMultipleTxs
parameter is a valuable addition that provides flexibility for complex bridging scenarios.
304-317
: Updated moduleNames handling in finalizeBridgeQuoteV2The function now collects multiple module names in an array rather than using a single module name. This aligns with the change to
BridgeQuoteV2
type in types.ts.
140-161
:❓ Verification inconclusive
Updated documentation and return type change for getBridgeRouteV2
The function now returns
Promise<BridgeRouteV2 | undefined>
instead of justPromise<BridgeRouteV2>
. This is a meaningful API change that allows the method to signal when no valid route is found.This change to the return type is a potentially breaking change. Please ensure that all consumers of this API handle the case where
undefined
is returned.
🏁 Script executed:
#!/bin/bash # Check for places where getBridgeRouteV2 is called and might not handle undefined rg "getBridgeRouteV2\(" --type=ts -A 5 -B 5 | grep -v "undefined" | grep -e "=" -e "return"Length of output: 459
Action Required: Verify Handling of Undefined in getBridgeRouteV2 Consumers
The updated documentation now correctly reflects that
getBridgeRouteV2
returns aPromise<BridgeRouteV2 | undefined>
, signaling the possibility of a missing route. However, our grep search indicates that several consumers (e.g., inpackages/sdk-router/src/operations/bridge.ts
) invoke this API without an explicit check for anundefined
result. Additionally, other modules such as those in the router sets are returning fallback empty arrays, which may not be sufficient handling.
- Review the consumer in
packages/sdk-router/src/operations/bridge.ts
to ensure that it properly tests for anundefined
return before proceeding.- Double-check similar patterns in modules like
synapseRouterSet.ts
,gasZipModuleSet.ts
, andsynapseCCTPRouterSet.ts
to verify that the potential absence of a route is handled correctly.Please verify and update the usage across the codebase as needed to ensure robust handling of the new return type.
packages/sdk-router/src/module/types.ts (2)
101-129
: Updated BridgeQuoteV2 type with moduleNames and additional propertiesThe changes to
BridgeQuoteV2
:
- Replace
moduleName: string
withmoduleNames: string[]
to support multiple modules- Add
gasDropAmount: BigNumber
- Add optional
tx?: PopulatedTransaction
These changes enhance the flexibility of the bridge quote system while maintaining clear documentation.
131-160
: New IntentStep type for atomic intent operationsThe introduction of the
IntentStep
type is well-structured and thoroughly documented. This type appears to be a key component for the new intent endpoint mentioned in the PR title.Some observations:
- It shares several fields with
BridgeQuoteV2
but is structured to represent a single atomic operation- The design supports both cross-chain (different
fromChainId
andtoChainId
) and same-chain operations- The inclusion of
moduleNames
as an array aligns with the updates toBridgeQuoteV2
contrib/restclient/client.gen.go (5)
521-523
: Interface method looks consistent
The newly addedGetIntent
method is aligned with other client methods. Ensure that all downstream users are updated to call this method where necessary.
1840-1994
: Query parameter builder
NewGetIntentRequest
accurately maps struct fields to query parameters. No significant issues found.🧰 Tools
🪛 GitHub Check: codecov/patch
[warning] 1840-1846: contrib/restclient/client.gen.go#L1840-L1846
Added lines #L1840 - L1846 were not covered by tests
[warning] 1848-1851: contrib/restclient/client.gen.go#L1848-L1851
Added lines #L1848 - L1851 were not covered by tests
[warning] 1853-1856: contrib/restclient/client.gen.go#L1853-L1856
Added lines #L1853 - L1856 were not covered by tests
[warning] 1858-1869: contrib/restclient/client.gen.go#L1858-L1869
Added lines #L1858 - L1869 were not covered by tests
[warning] 1873-1881: contrib/restclient/client.gen.go#L1873-L1881
Added lines #L1873 - L1881 were not covered by tests
[warning] 1885-1893: contrib/restclient/client.gen.go#L1885-L1893
Added lines #L1885 - L1893 were not covered by tests
[warning] 1897-1907: contrib/restclient/client.gen.go#L1897-L1907
Added lines #L1897 - L1907 were not covered by tests
[warning] 1913-1921: contrib/restclient/client.gen.go#L1913-L1921
Added lines #L1913 - L1921 were not covered by tests
[warning] 1925-1933: contrib/restclient/client.gen.go#L1925-L1933
Added lines #L1925 - L1933 were not covered by tests
[warning] 1937-1947: contrib/restclient/client.gen.go#L1937-L1947
Added lines #L1937 - L1947 were not covered by tests
[warning] 1953-1963: contrib/restclient/client.gen.go#L1953-L1963
Added lines #L1953 - L1963 were not covered by tests
[warning] 1969-1979: contrib/restclient/client.gen.go#L1969-L1979
Added lines #L1969 - L1979 were not covered by tests
[warning] 1985-1985: contrib/restclient/client.gen.go#L1985
Added line #L1985 was not covered by tests
[warning] 1988-1991: contrib/restclient/client.gen.go#L1988-L1991
Added lines #L1988 - L1991 were not covered by tests
[warning] 1993-1993: contrib/restclient/client.gen.go#L1993
Added line #L1993 was not covered by tests
3583-3673
: Enhance coverage for response parsing
GetIntentResponse
appears to have no direct tests. Consider adding test scenarios for 200, 400, and 500 responses to verify correct parsing of fields likeSteps
andMinToAmount
.
4837-4838
: Ensure robust parsing ofModuleNames
WithinparseGetBridgeV2Response
, confirm it safely handles an empty list or absent property (in casemoduleNames
is not returned by the server).🧰 Tools
🪛 GitHub Check: codecov/patch
[warning] 4837-4838: contrib/restclient/client.gen.go#L4837-L4838
Added lines #L4837 - L4838 were not covered by tests
6108-6109
: HandleModuleNames
arrays
When parsingModuleNames
inparseGetSwapV2Response
, confirm that multiple swap modules or an empty list are processed without issue.🧰 Tools
🪛 GitHub Check: codecov/patch
[warning] 6108-6109: contrib/restclient/client.gen.go#L6108-L6109
Added lines #L6108 - L6109 were not covered by testspackages/rest-api/swagger.json (3)
147-153
: Support for multiple modules
This change from a single"moduleName"
property to"moduleNames"
allows specifying multiple modules for a given quote, which is more flexible and extensible.
1427-1736
: Add test coverage for the new/intent
endpoint
A new endpoint has been introduced for retrieving intent quotes. Please consider adding test coverage (integration or unit tests) to verify parameter validation, error handling, and response correctness. This helps ensure reliable behavior and detect regressions early.🧰 Tools
🪛 Gitleaks (8.21.2)
1642-1642: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
1645-1645: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
1652-1652: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
1655-1655: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
2006-2012
: Transition to an array-based module listing
Renaming"moduleName"
to"moduleNames"
is aligned with the multi-module approach observed in other parts of the codebase. This change looks consistent and well-structured.packages/sdk-router/src/rfq/fastBridgeRouterSet.ts (5)
98-100
: Graceful fallback for unsupported chains
Returning an empty array when either chain is not supported prevents errors and makes the function more robust.
123-130
: Validation ensures both chains are supported for bridging
These checks confirm that the router modules exist on both the origin and destination chains, and also enforce single-transaction flows if multipleTxs is disallowed.
156-158
: Early exit on zero expected amount
Returningundefined
ifexpectedToAmount
is zero is a logical way to handle routes that won’t yield any usable tokens on the destination chain.
404-405
: Optional final token parameter
MakingtokenOut
optional here matches scenarios where multi-step transactions or flexible output tokens are allowed. No concerns identified.
409-421
: Improved filtering withisSameAddress
The use ofisSameAddress
for comparing FastBridge addresses and optional tokens ensures case-insensitive and format-agnostic checks. This promotes correctness across chain addresses.packages/sdk-router/src/operations/bridge.ts (14)
4-4
: Imported chain ID checks
AddingareIntentsSupported
andisChainIdSupported
provides consistent validation mechanisms for bridging flows.
11-11
: ImportingisSwapQuery
IncludingisSwapQuery
broadens the code’s ability to differentiate swap-based routes from direct bridging operations.
14-20
: Additional swap-related imports
Bringing in new swap types and constants (e.g.,EngineID
,RouteInput
) lays the groundwork for more cohesive bridging and swapping integrations.
21-21
: Utility import forPrettify
UsingPrettify<T>
helps maintain type clarity in the new bridging parameters.
48-50
: NewBridgeV2InternalParameters
ExtendingBridgeV2Parameters
with an optionalallowMultipleTxs
accommodates more complex bridging scenarios.
55-58
: Add test coverage for_bridgeV2Internal
usage
Line 57 is flagged for lacking coverage. Consider adding a test case covering this scenario, ensuring thatallowMultipleTxs
is enforced as intended.🧰 Tools
🪛 GitHub Check: codecov/patch
[warning] 57-57: packages/sdk-router/src/operations/bridge.ts#L57
Added line #L57 was not covered by tests
60-63
: Internal bridging function
_bridgeV2Internal
centralizes bridging logic while supporting multi-transaction flows. This separation of concerns is a good design choice.
84-89
: Check if both chains are supported
The fallback returning an empty list iffromChainId
ortoChainId
is unsupported is correct. Also note line 88 is missing unit test coverage; embedding a test ensures reliability.🧰 Tools
🪛 GitHub Check: codecov/patch
[warning] 88-88: packages/sdk-router/src/operations/bridge.ts#L88
Added line #L88 was not covered by tests
126-129
: Dynamically append swap module
Conditionally adding the swap engine name for origin query fosters more flexible route creation.
165-171
: Intents must be supported on fromChain
VerifyingareIntentsSupported
for the origin chain andisChainIdSupported
for the destination chain avoids invalid bridging attempts.
182-182
: Conditionally unsettoToken
By assigningtoToken = undefined
when multiple transactions are permitted, the logic can compile multi-step routes freely.
238-239
: Propagating multi-tx option
ForwardingallowMultipleTxs
into the bridging route ensures the final bridging step respects multi-tx constraints.
241-243
: Safe return on missing route
Opting out early when the bridge route is undefined prevents further processing on invalid flows.
245-250
: Ensuring final token match
IfallowMultipleTxs
is false, verifying the final token matchesparams.toToken
helps enforce single-step bridging integrity.packages/sdk-router/src/operations/intent.ts (2)
38-45
: Validate cross-chain vs. same-chain decision logic.Using
params.fromChainId === params.toChainId
to decide which function to call is straightforward. However, consider the scenario in which the chain IDs match but the swap logic still needs bridging (unusual, but theoretically possible). If you anticipate that scenario, add an additional check or documentation clarifying that bridging is strictly disabled for same-chain quotes.
85-85
: Address TODO on returning multiple quotes.The comment “// TODO: do we need to return multiple quotes?” suggests uncertainty about whether multiple swap routes should be presented. If there's a valid use case for returning multiple same-chain quotes to the caller, consider implementing that logic or removing the comment once you've finalized your design choice.
export const areIntentsSupported = ( | ||
chainId: number | ||
): chainId is SupportedChainId => INTENTS_SUPPORTED_CHAIN_IDS.includes(chainId) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Verification agent
❓ Verification inconclusive
Add test coverage for the areIntentsSupported function.
The function looks well-implemented, but static analysis shows it lacks test coverage. Consider adding unit tests to ensure proper behavior across different chainId values.
🏁 Script executed:
#!/bin/bash
# Check if there are tests for the areIntentsSupported function
grep -r "areIntentsSupported" --include="*.test.ts" --include="*.spec.ts" .
Length of output: 75
ACTION REQUIRED: Add Unit Tests for areIntentsSupported
The function in packages/sdk-router/src/constants/chainIds.ts
currently has no test coverage. Automated search for tests (using patterns in *.test.ts
and *.spec.ts
files) did not yield any results. Please add unit tests that verify:
- It returns
true
for chain IDs that are included in theINTENTS_SUPPORTED_CHAIN_IDS
array. - It returns
false
for chain IDs that are not included.
This will help ensure the function behaves correctly across different input scenarios.
🧰 Tools
🪛 GitHub Check: codecov/patch
[warning] 138-138: packages/sdk-router/src/constants/chainIds.ts#L138
Added line #L138 was not covered by tests
async function _getCrossChainIntentQuotes( | ||
6D40 | this: SynapseSDK, | |
params: IntentParameters | ||
): Promise<IntentQuote[]> { | ||
// First, collect V2 quotes into either the requested token (can fallback to the bridge token if not available). | ||
const toRecipient = params.toRecipient || params.fromSender | ||
const bridgeQuotes = await _bridgeV2Internal.call(this, { | ||
fromChainId: params.fromChainId, | ||
toChainId: params.toChainId, | ||
fromToken: params.fromToken, | ||
toToken: params.toToken, | ||
fromAmount: params.fromAmount, | ||
fromSender: params.fromSender, | ||
toRecipient, | ||
slippage: params.slippage, | ||
deadline: params.deadline, | ||
allowMultipleTxs: params.allowMultipleTxs, | ||
}) | ||
|
||
// Then, iterate over the quotes and add the swap step, if needed. | ||
const intentQuotes: IntentQuote[][] = await Promise.all( | ||
bridgeQuotes.map(async (bridgeQuote) => { | ||
const id = uuidv7() | ||
const intentCommon = { | ||
fromChainId: params.fromChainId, | ||
fromToken: params.fromToken, | ||
fromAmount: BigNumber.from(params.fromAmount), | ||
toChainId: params.toChainId, | ||
} | ||
const bridgeStep: IntentStep = { | ||
...intentCommon, | ||
toToken: bridgeQuote.toToken, | ||
expectedToAmount: bridgeQuote.expectedToAmount, | ||
minToAmount: bridgeQuote.minToAmount, | ||
routerAddress: bridgeQuote.routerAddress, | ||
estimatedTime: bridgeQuote.estimatedTime, | ||
moduleNames: bridgeQuote.moduleNames, | ||
gasDropAmount: bridgeQuote.gasDropAmount, | ||
tx: bridgeQuote.tx, | ||
} | ||
// Check if the token out is the same as the requested token out. | ||
if (isSameAddress(params.toToken, bridgeQuote.toToken)) { | ||
const intentQuote: IntentQuote = { | ||
id, | ||
...intentCommon, | ||
toToken: params.toToken, | ||
expectedToAmount: bridgeQuote.expectedToAmount, | ||
minToAmount: bridgeQuote.minToAmount, | ||
estimatedTime: bridgeQuote.estimatedTime, | ||
steps: [bridgeStep], | ||
} | ||
return [intentQuote] | ||
} | ||
// Otherwise we need to find a swap quote between the bridge token and the requested token out on the destination chain. | ||
const swapQuotes = await _getSameChainIntentQuotes.call(this, { | ||
fromChainId: params.toChainId, | ||
fromToken: bridgeQuote.toToken, | ||
fromAmount: bridgeQuote.expectedToAmount, | ||
fromSender: toRecipient, | ||
toChainId: params.toChainId, | ||
toToken: params.toToken, | ||
toRecipient, | ||
slippage: params.slippage, | ||
}) | ||
return swapQuotes.map((swapQuote) => { | ||
const intentQuote: IntentQuote = { | ||
id, | ||
...intentCommon, | ||
toToken: params.toToken, | ||
expectedToAmount: swapQuote.expectedToAmount, | ||
minToAmount: swapQuote.minToAmount, | ||
estimatedTime: bridgeQuote.estimatedTime + swapQuote.estimatedTime, | ||
steps: [bridgeStep, ...swapQuote.steps], | ||
} | ||
return intentQuote | ||
}) | ||
}) | ||
) | ||
// Flatten the quotes and sort them by expectedToAmount in descending order | ||
return intentQuotes | ||
.flat() | ||
.sort((a, b) => (a.expectedToAmount.gte(b.expectedToAmount) ? -1 : 1)) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Ensure error handling for partial or failed cross-chain steps.
When bridging and then swapping cross-chain, _getCrossChainIntentQuotes
handles each quote via Promise.all()
. If an individual quote unexpectedly fails (e.g., RPC error, liquidity error), it returns an empty sub-array or short-circuits. You might want to consider graceful error recovery or logging for each failure scenario, helping you or end users debug issues in bridging or swapping flows.
Bundle ReportChanges will increase total bundle size by 305.44kB (0.95%) ⬆️. This is within the configured threshold ✅ Detailed changes
Affected Assets, Files, and Routes:view changes for bundle: explorer-ui-client-array-pushAssets Changed:
view changes for bundle: sdk-router-@synapsecns/sdk-router-esmAssets Changed:
Files in
view changes for bundle: sdk-router-@synapsecns/sdk-router-cjsAssets Changed:
Files in
|
* Ft/ponder ix hyp evm (#3571) * add hyperevm to ponder ix * addtl hypevm chain config --------- Co-authored-by: parodime <noreply@protochainresearch.com> * Publish - @synapsecns/rfq-indexer-api@1.1.0 - @synapsecns/rfq-indexer@0.0.7 * ponder ix - set hyperEVM block range to 50 * fix: hyperEVM block range * ponder ix - alter hype start block * Fix multi-architecture build for Hyperliquid Node Image (#3574) * hl docker image * fix(workflow): move date tag creation to separate step in hyperliquid workflow 🤖 Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com> * fix(workflow): remove load flag and use local image for tagging in hyperliquid workflow * fix(workflow): use build-push-action for date tagging in hyperliquid workflow * feat(workflow): add multi-architecture support and mainnet image build for hyperliquid * fix(workflow): update hyperliquid workflow to use local Dockerfile for better multi-arch support * fix(hyperliquid): update binary URL paths to match node documentation * fix(hyperliquid): temporarily skip GPG verification due to inconsistent path issues * fix(hyperliquid): always use Testnet binary since Mainnet binary is not publicly accessible * fix(hyperliquid): use correct URL for Mainnet binary --------- Co-authored-by: Trajan0x <trajan0x@users.noreply.github.com> * feat: Swap Engines [SYN-29] [SYN-35] (#3563) * feat: SIR binding, StepParams, ZapData encoding * feat: engine quote/route structs * feat: slippage utils * feat: no-op engine * feat: add Default Engine * feat: Kyber, Li.FI engines * feat: paraSwap module * feat: SwapEngineSet * feat: add SwapEngineSet to SDK * feat: Synapse Intent Router * feat: expose swapV2 * feat: add swapV2 controller * feat: add swapV2 route * fix: null behaviour consistent with bridge route * fix: remove originUserAddress for swapV2 * feat: swapV2 to use native amounts (wei) * fix: swap/v2 route * fix: tests * feat: add production contracts * chore: reorder KyberSwap chains, add bnerachain * feat: expand list of supported chains for /swap/v2 * refactor: use named paramters for swapV2 * fix: set default slippage to 0.5%; stringify tx.value * chore: generate docs * Publish - @synapsecns/rest-api@1.10.0 - @synapsecns/sdk-router@0.13.0 - @synapsecns/synapse-interface@0.42.6 - @synapsecns/widget@0.9.17 - @synapsecns/rfq-indexer@0.0.8 * fix: mockCallRevert internal revert (#3575) * Publish - @synapsecns/contracts-rfq@0.16.2 * feat(contracts-rfq): deploy SIR [SYN-29] (#3573) * fix: adjust comment for #3467 * chore: mainnet -> ethereum * feat: update deploy scripts, prepare create2 salts * chore: add deployments from new chains * chore: add chain IDs to foundry.toml * chore: add utility scripts * deploy: SIR and periphery on 12 chains * deploy: SIR at 0x512000...000512 address * fix: update SIR address * Publish - @synapsecns/contracts-rfq@0.17.0 - @synapsecns/rest-api@1.10.1 - @synapsecns/sdk-router@0.14.0 - @synapsecns/synapse-interface@0.42.7 - @synapsecns/widget@0.9.18 * feat: SDK new chains [SYN-45] (#3535) * feat: add HyperEVM to sdk-router * feat: use staging RFQ API [REVERT LATER] * feat: add HYPE-USDC, HYPE-ETHto the bridge map * fix: add HYPE, HyperEVM to rest-api * feat: update rest-api bridge map * chore: add envs for api urls (#3537) Co-authored-by: Trajan0x <trajan0x@users.noreply.github.com> * chore: make prod RFQ API the default value * feat: support multiple RFQ APIs * fix: don't report negative bridge fee for RFQ * test: adjus the amount of token pairs for USDC --------- Co-authored-by: trajan0x <83933037+trajan0x@users.noreply.github.com> Co-authored-by: Trajan0x <trajan0x@users.noreply.github.com> * Publish - @synapsecns/rest-api@1.11.0 - @synapsecns/sdk-router@0.15.0 - @synapsecns/synapse-interface@0.43.0 - @synapsecns/widget@0.9.19 * fix: hide slippage between different type of assets for now [SYN-39] (#3590) * Publish - @synapsecns/synapse-interface@0.43.1 * Support Swap V2 endpoint on Synapse REST client (#3593) * fix(rest-api): swap v2 errors (#3594) * fix: check if tx is defined * chore: correct endpoint name in error * Publish - @synapsecns/rest-api@1.11.1 * feat: sdk/api bridgeV2 for SynapseRFQ [SYN-66] (#3588) * feat: scaffold bridgeV2 * feat: complete bridgeV2, scaffold module impls * feat: airdrop amount in bridgeV2 * feat: bridgeV2 for SynapseRFQ * fix: add more info to SwapEngine quotes, type assertions * feat: /bridge/v2 * chore: generate docs * refactor: steps params manipulation * feat: cap origin slippage * feat: cache getAllQuotes calls * fix(rest-api): improve bridge v2 response format - Replace BigNumber response objects with string values - Rename maxAmountOutStr to maxAmountOut for cleaner API - Update swagger documentation to reflect changes 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * feat(restclient): add bridge v2 endpoint support - Add GetBridgeV2 and related parameters to REST client - Update type definitions for bridge v2 response format - Synchronize with recent bridge v2 API changes 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> --------- Co-authored-by: Claude <noreply@anthropic.com> * [DI-48] fix: replace vulnerable tj-actions actions with dorny/paths-filter (#3595) Replace all tj-actions actions (changed-files, verify-changed-files, branch-names) with secure alternatives to mitigate the security vulnerability. Used dorny/paths-filter for file checking and bash scripts for branch name detection. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> Co-authored-by: Trajan0x <trajan0x@users.noreply.github.com> * chore(rest-api): edit README to trigger republish (#3597) * Publish - @synapsecns/rest-api@1.12.0 * chore(sdk-router): edit README to trigger republish (#3598) * Publish - @synapsecns/rest-api@1.12.1 - @synapsecns/sdk-router@0.16.0 - @synapsecns/synapse-interface@0.43.2 - @synapsecns/widget@0.9.20 * chore(sdk-router): cleanup types, remove unused utilities (#3600) * feat: add Prettify utility type for better IDE type display Adds a Prettify<T> utility type that improves how types are displayed in the IDE: - Applied to union types to show all properties - Applied to Partial/Required patterns to show complete property set - Applied to complex types with optional properties 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * chore(sdk-router): apply Prettify to complex types - Add Prettify utility type to intersection types and type modifiers - Create PartialZapDataV1 type for better reusability - Update function signatures to use new type definitions - Improve IDE display of complex types 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * chore(sdk-router): remove unused entity files and utils Removed deprecated entity files and utility functions that are no longer needed in the SDK router package. These files were likely imported from another SDK and are not currently being used. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * refactor(sdk-router): centralize utilities through utils/index.ts - Modified utils/index.ts to use export * from each utility module - Updated all imports to reference the centralized utils module instead of individual utility files - This change makes the codebase more maintainable and easier to refactor 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * chore(sdk-router): enforce alphabetical ordering of imports - Added alphabetical ordering rule to ESLint configuration - Auto-fixed imports order in all files to comply with the new rule - This enforces a consistent import style throughout the codebase 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * refactor(sdk-router): replace BigintIsh with ethers' BigNumberish Replace all occurrences of custom BigintIsh type with the standard BigNumberish from ethers.js. This standardizes the codebase by using established types from the core library. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> --------- Co-authored-by: Claude <noreply@anthropic.com> * Publish - @synapsecns/rest-api@1.12.2 - @synapsecns/sdk-router@0.16.1 - @synapsecns/synapse-interface@0.43.3 - @synapsecns/widget@0.9.21 * fix(rest-api,sdk-router): `/bridge/v2` and `swap/v2` endpoint standardisation [SYN-77] (#3602) * refactor: consistent params naming in swap/bridge V2 * feat: enrich SwapQuoteV2 * feat: enrich BridgeQuoteV2 * feat: update V2 endpoints in rest-api * chore: update the swagger docs * refactor: id ordering * chore: regenerate restclient * chore: fix example router address in `/swap/v2` response * fix: add swap module name, same token swaps * fix: unify swap/bridge module names in V2 only * chore: unified "module name" in rest-api * fix: remove string cast * fix: SDK tests * Apply suggestions from code review Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> --------- Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Publish - @synapsecns/rest-api@1.12.3 - @synapsecns/sdk-router@0.16.2 - @synapsecns/synapse-interface@0.43.4 - @synapsecns/widget@0.9.22 * chore(sdk-router): cleanup logging, engine priorities (#3610) * refactor: clean up engine priorities * chore: remove execution time logging * fix: adjust engine priorities * Publish - @synapsecns/rest-api@1.12.4 - @synapsecns/sdk-router@0.16.3 - @synapsecns/synapse-interface@0.43.5 - @synapsecns/widget@0.9.23 * feat(rest-api,sdk-router): intent endpoint [SYN-77] (#3613) * feat: scaffold `intent` function * feat: scaffold multiple txs in bridgeV2 * feat: optional `tokenOut` in bridge token candidate search * feat: allow multiple txs in `bridgeV2` * feat: single-chain swap intents * feat: cross-chain intents * feat: expose `/intent` endpoint * chore: generate swagger * fix: report all module names within the intent step * chore: rename into "default pools" engine * chore: update swagger, regenerate client * fix: prevent errors on unsupported RFQ routes in V2 endpoints * fix: block times, supported intent chains * fix: fromAmount string * Publish - @synapsecns/rest-api@1.13.0 - @synapsecns/sdk-router@0.17.0 - @synapsecns/synapse-interface@0.43.6 - @synapsecns/widget@0.9.24 * fix(sdk-router): export intent types (#3620) * fix: export intent types * fix: export bridge types * fix: export swap types * fix: imports in tests * Publish - @synapsecns/rest-api@1.13.1 - @synapsecns/sdk-router@0.17.1 - @synapsecns/synapse-interface@0.43.7 - @synapsecns/widget@0.9.25 * upgrading to reference cortex much more * adding new links etc * Publish - @synapsecns/bridge-docs@0.6.7 - @synapsecns/explorer-ui@0.5.15 - @synapsecns/synapse-interface@0.43.8 - @synapsecns/widget@0.9.26 * fix(sdk-router): exported slippage type (#3634) * fix: use slippagePercentage in exported types * fix: use slippage percentage in rest-api * Publish - @synapsecns/rest-api@1.13.2 - @synapsecns/sdk-router@0.17.2 - @synapsecns/synapse-interface@0.43.9 - @synapsecns/widget@0.9.27 * fix(sdk-router, rest-api): stringify BigNumber in exported V2 types [SYN-77] (#3636) * fix: stringify BigNumber in exported V2 types * fix: update bridge modules * fix: update V2 operations * fix: update rest-api * Publish - @synapsecns/rest-api@1.13.3 - @synapsecns/sdk-router@0.17.3 - @synapsecns/synapse-interface@0.43.10 - @synapsecns/widget@0.9.28 * Update bl * fix(sdk-router): restrict `fromAmount` to `string` in the exported intent parameters (#3645) * chore: fix existing documentation * fix: restrict fromAmount type to string in exported parameters * Publish - @synapsecns/rest-api@1.13.4 - @synapsecns/sdk-router@0.17.4 - @synapsecns/synapse-interface@0.43.11 - @synapsecns/widget@0.9.29 * fix(sdk-router): add decimals to intent steps (#3646) * refactor: isolate token decimals retrieval * fix: add decimal metadata to each intent step * fix: make tokenMetadataFetcher optional * Publish - @synapsecns/rest-api@1.13.5 - @synapsecns/sdk-router@0.17.5 - @synapsecns/synapse-interface@0.43.12 - @synapsecns/widget@0.9.30 * fix(sdk-router): add `HYPEREVM` to intents supported chains * chore: small change to publish 9abecbe (#3648) * Publish - @synapsecns/rest-api@1.13.6 - @synapsecns/sdk-router@0.17.6 - @synapsecns/synapse-interface@0.43.13 - @synapsecns/widget@0.9.31 * fix(sdk-router): swap engine improvements, remove cap on RFQ origin slippage (#3652) * fix: exclude RFQ sources on KyberSwap * fix: paraSwap partner, LiFi timing strategy * feat: use FBI for Route V2 zap data * fix: make minToAmount requied in SwapEngineRoute * fix: don't cap origin slippage * fix: don't use interceptor without origin swaps * Publish - @synapsecns/rest-api@1.13.7 - @synapsecns/sdk-router@0.17.7 - @synapsecns/synapse-interface@0.43.14 - @synapsecns/widget@0.9.32 * removing old routes and tokens * Publish - @synapsecns/bridge-docs@0.6.8 * Adding hyperevm to the explorer (#3647) * adding hyperevm [goreleaser] * updating chart color * fixing pricing issues [goreleaser] * fix for native tokens [goreleaser] * fixing bera weth [goreleaser] * removing all old fetcher changes * [goreleaser] * lint --------- Co-authored-by: parodime <jordan@protochainresearch.com> * Publish - @synapsecns/explorer-ui@0.5.16 * adding hyperevm to constants * Publish - @synapsecns/bridge-docs@0.6.9 - @synapsecns/explorer-ui@0.5.17 - @synapsecns/rest-api@1.13.8 - @synapsecns/synapse-constants@1.8.10 * Deprecate and remove go restclient module [SYN-88] (#3658) --------- Co-authored-by: Trajan0x <trajan0x@users.noreply.github.com> * SYN-86 Delete Old exporters and remove unused code (#3656) Co-authored-by: Trajan0x <trajan0x@users.noreply.github.com> * SYN-87 Remove SignOz functionality from opbot (#3657) * SYN-87 Remove SignOz functionality from opbot - Removed SignOz client and package - Removed SignOz configuration fields - Removed traceCommand dependent on SignOz - Updated README to remove SignOz references - Added CLAUDE.md for automated operations - Fixed formatting and ensured code builds correctly * update go.work.sum * Fix goimports formatting issues for linting * [goreleaser] * nuke signoz example [goreleaser] --------- Co-authored-by: Trajan0x <trajan0x@users.noreply.github.com> * feat(contracts-rfq): fast bridge interceptor [SYN-84] (#3649) * feat: scaffold FastBridgeInterceptor * test: add coverage * feat: implement interceptor * test: different decimals ratio * docs: improve FastBridgeInterceptor documentation - Add clear NatSpec documentation to both implementation and interface - Focus user documentation on integration aspects - Clarify contract behavior and edge cases - Follow Solidity documentation standards - Fix typo in interface documentation 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * chore: fix lint * refactor: relabel percentage vars * build: deploy Interceptor on supported mainnets --------- Co-authored-by: Claude <noreply@anthropic.com> * Publish - @synapsecns/contracts-rfq@0.18.0 * feat(contracts-rfq): sir new deployments (#3662) * build: add new chains to config * chore: deploy on avax and polygon * Publish - @synapsecns/contracts-rfq@0.19.0 * fix(sdk-router): address utils, URLs in constructor, ParaSwap surplus (#3660) * fix: `handleNativeToken` non-checksummed address, reorganize * fix: export address utils * refactor: handleParams * test: ensure that 0xEE is working with integrations * feat: pass paraswap surplus to user * feat: allow passing URLs in SDK constructor * fix: use Gas.Zip contract deposit * fix: types * feat: intents with gas.zip * build: add sdk:stream script * feat: add Avax, Ploygon to intents chain ids * refactor: chainProviders init logic * fix: enforce gas.zip min/max usd value * Publish - @synapsecns/rest-api@1.13.9 - @synapsecns/sdk-router@0.17.8 - @synapsecns/synapse-interface@0.43.15 - @synapsecns/widget@0.9.33 * fix(sdk-router): faster intent quotes, time logging, Paraswap surplus [SYN-97] (#3672) * fix: make logExecutionTime more generic * chore: add execition time logging * fix: paraswap surplus * fix: use longer cache for RFQ available tokens, shorter cache for quotes * feat: getFastestQuote * chore: remove old getBestQuote * fix: timeouts * chore: fix incorrect comments * fix: make logging work with minimised package * fix: prevent unhandled rejections in quote processing - Improve _getFastestQuote to properly handle all promises even when returning early - Use Promise.allSettled in the background to ensure all rejections are caught - Maintain fast response time while avoiding unhandled promise rejections 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * fix: ensure timing is logged even when methods throw errors - Wrap method execution in try/finally to log execution time in all cases - Ensure original errors are propagated properly - Simplify code with direct return in try block 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * fix: ensure consistent cache keys in FastBridgeRouterSet - Fix cache key inconsistency in getAllQuotes method - Ensure cache keys match between get and set operations - Use enum values directly in cache key construction 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * fix: variable shadowing --------- Co-authored-by: Claude <noreply@anthropic.com> * Publish - @synapsecns/rest-api@1.13.10 - @synapsecns/sdk-router@0.17.9 - @synapsecns/synapse-interface@0.43.16 - @synapsecns/widget@0.9.34 * fix(sdk-router): gas.zip block height (#3675) * feat: add latest block endpoint * fix: don't use gas.zip quotes for stale chains * fix: getBlock error cases * fix: safer API data manipulation * Publish - @synapsecns/rest-api@1.13.11 - @synapsecns/sdk-router@0.17.10 - @synapsecns/synapse-interface@0.43.17 - @synapsecns/widget@0.9.35 --------- Co-authored-by: parodime <jordan@protochainresearch.com> Co-authored-by: parodime <noreply@protochainresearch.com> Co-authored-by: parodime <parodime@users.noreply.github.com> Co-authored-by: trajan0x <83933037+trajan0x@users.noreply.github.com> Co-authored-by: Trajan0x <trajan0x@users.noreply.github.com> Co-authored-by: ChiTimesChi <ChiTimesChi@users.noreply.github.com> Co-authored-by: vro <168573323+golangisfun123@users.noreply.github.com> Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> Co-authored-by: defi-moses <jakedinero@protonmail.com> Co-authored-by: Moses <103143573+Defi-Moses@users.noreply.github.com> Co-authored-by: Defi-Moses <Defi-Moses@users.noreply.github.com> Co-authored-by: aureliusbtc <82057759+aureliusbtc@users.noreply.github.com>
Description
A clear and concise description of the features you're adding in this pull request.
Additional context
Add any other context about the problem you're solving.
Metadata
Summary by CodeRabbit